Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, July 6, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: v7.5 - How to pass Account field values to AddEdit form?
Jim Mizia
Posts: 49
 
v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 1:54 PM
I have an account tab that includes a 1:M grid. When I launch the AddEdit form for the purpose of adding a record to the grid, I would like to display the account name and account type on the form. Since the record is not yet created when the form launches, I don't seem to be able to reference the account values.

Can someone tell me how I can display these values when adding a record? Thanks!

Jim M.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 2:04 PM
Pass it as a Dialog Parameter.....

To set it:
DialogService.DialogParameters.Add("myAcct", account);

To read it:
Sage.Entity.Interfaces.IAccount myAccount = DialogService.DialogParameters["myAcct"] as Sage.Entity.Interfaces.IAccount;

[Reply][Quote]
Jim Mizia
Posts: 49
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 2:18 PM
I'm new to this development environment ...

Where do I set the Dialog Parameters, in the load action on the form, or possibly in the properties of the "Insert" QFButton?

Thanks!
[Reply][Quote]
Jim Mizia
Posts: 49
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 May 09 11:21 AM
I'm hoping to get some guidance on the use of Dialog parameters.

My account tab form has an "Insert" QFButton on the toolbar. This button triggers an "Insert Child Dialog" action that brings up my AddEdit form SmartPart.

I'd like to use the following code to pass the account name and type to the AddEdit form.

DialogService.DialogParameters.Add("txtAccountName", account);
DialogService.DialogParameters.Add("txtAccountType", type);

Where do I put this code so that I can reference the "txtAccountName" and "txtAccountType" variables from within the load actions on the AddEdit form?


[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 May 09 2:53 PM
I am not sure about the DialogParameters, but within the load action of the AddEdit form you can use GetParentEntity to get a reference to the parent entity (in a snippet action item or a custom smartpart).

Then you can use stuff like:

txtAccountName.Text = ((IAccount)GetParentEntity()).AccountName;

[Reply][Quote]
Jim Mizia
Posts: 49
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 May 09 8:58 AM
Thanks for the input Nicolas. I tried the suggested code, but I got an error trying to reference IAccount. It said that "The type or namespace name 'IAccount' could not be found". Since I apparently don't know what I am doing, it's time to get specific.

I have a form called AddEditCEngOpp. In the load actions for that form I have the following code.
********************************
if (!EntityContext.EntityID.ToString().ToUpper().Equals("INSERT")) // Editing existing record
{
// Populate/enable some form fields
}
else // Adding NEW record
{
txtJimField.Text = ((IAccount)GetParentEntity()).AccountName;
}
********************************

Can someone tell me what I need to do to make this code work? Thanks!
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 May 09 10:07 AM
Try this one (sorry, I am used to working with custom smart part where visual studio fixes the reference automatically):

if (!EntityContext.EntityID.ToString().ToUpper().Equals("INSERT")) // Editing existing record
{
// Populate/enable some form fields
}
else // Adding NEW record
{
txtJimField.Text = ((Sage.Entity.Interfaces.IAccount)GetParentEntity()).AccountName;
}
[Reply][Quote]
Jim Mizia
Posts: 49
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 May 09 2:48 PM
Progress!!

I can populate my unbound form fields during an ADD as follows:

if (!EntityContext.EntityID.ToString().ToUpper().Equals("INSERT")) // Editing existing record
{
// Modify various form properties
}
else // Adding NEW record
{
lblPageBanner.Text = "INSERT NEW ENGINEERING OPPORTUNITY for:";
txtAccountLocation.Text = ((Sage.Entity.Interfaces.IAccount)GetParentEntity()).Address.City + ", " + ((Sage.Entity.Interfaces.IAccount)GetParentEntity()).Address.State + " " + ((Sage.Entity.Interfaces.IAccount)GetParentEntity()).Address.PostalCode;
}

I haven't been able to use this approach to pre-populate bound form fields as I believe that they are being over written by blank database values. I am playing with OnCreate events to address applying default values for bound form fields. I may also circle back on the "DialogParameter" approach. Thanks to all for the help!
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 May 09 3:00 PM
One thing that may work is something like (in the load action - assuming the child entity is AccountProduct):

if(((Sage.Entity.Interfaces.IAccountProduct)BindingSource.Current).Account == null)
((Sage.Entity.Interfaces.IAccountProduct)BindingSource.Current).Account = (Sage.Entity.Interfaces.IAccount)GetParentEntity()

Then all the databinding that pulls from the Account will work
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 May 09 3:05 PM
(duplicate)
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 May 09 5:12 PM
(double submission)
[Reply][Quote]
Jim Mizia
Posts: 49
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 May 09 10:50 AM
I'm not sure that I follow this assignment to the binding source. I think that I already have access to the parent field values using the construct that you provided earlier.

In the load action on the form I have been able to populate unbound text boxes with values from the parent entity as follows:

txtAccountBox.Text = ((Sage.Entity.Interfaces.IAccount)GetParentEntity()).AccountNameUpper;

If I use this same approach to populate a text box that is bound to a database field, it doesn't work. It doesn't give me an error, but I believe that the null value in the database field is clearing the text that I am placing in the field during the load action. I think that I either need to populate the bound form fields from within the OnCreate event (if that is even possible), or put some code behind by "save" button so that the bound form fields in the child table are populated with account information before the record is saved.
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 May 09 11:29 AM
Jim,
Bindings will override whatever you have put in the control in the onload event. What you want to do is to set the entity values for these fields. For example:

Sage.Entity.Interfaces.IMyEntity myent = BindingSource.Current as Sage.Entity.Interfaces.IMyEntity;
if (myent != null)
{
myent.MyProperty = ((Sage.Entity.Interfaces.IAccount)GetParentEntity()).AccountNameUpper;
}

This will populate the DB as well as the controls on the form.

You can use your other technique for non-bound fields as they will not be cleared after the onload event.
[Reply][Quote]
Jim Mizia
Posts: 49
 
Re: v7.5 - How to pass Account field values to AddEdit form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 May 09 3:14 PM
That did it for me! Nicolas had me close, but I couldn't get the syntax right.

Thanks to you both for all of your help!

Jim M.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/6/2025 1:44:28 PM