Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Getting around how the Address control’s Edit form is not editable in the SalesLogix Web Client

The Address control that is found on the Account and Contact detail forms in the SalesLogix web client is a custom composite control.  One of the features this gives you is an edit dialog to update the address fields. This is invoked when you click the Pencil Icon that is also part of the composite control:

Edit Address Dialog in Standard SalesLogix Address Control

 

Unfortunately this edit dialog, as well as most other attributes of the Address control are contained in a compiled Sage Web Control assembly and are not customizable.  The SalesLogix web client does have an OOTB edit address screen, that is invoked from the Address tab at the Account and Contact level.

Edit Address Quick Form in Standard SalesLogix

 

 

If you need to change the default address edit dialog (like if you have added a custom address field, or want some custom validations, etc) it would sure be nice to do this.  How can you though when the edit address dialog of the Address control is not customizable?  Well a little creativity is all you need.  lets take a look at how to do this.

Step 1- Add a custom load action

On the main detail quick form, add a C# Snippet Action Item to Page Load of the quickform (Make sure On Repaint Event of the code is set to True)

Address.ReadOnly = true;
Address_lbl.ForeColor = System.Drawing.Color.Blue;
Address_lbl.Style["text-decoration"] = "underline;";
Address_lbl.Text = "Edit Address";
Address_lbl.ToolTip = "Click to Edit Address";
Address_lbl.Attributes.Add("onclick", "var btn= document.getElementById('" + btnEditAddress.ClientID + "'); if(btn) btn.click();"); 
btnEditAddress.Style["Display"] = "none";

What this code is doing is setting the address control (Named Address) to be read only.  This will eliminate the pencil icon to prevent the wrong edit screen from opening.  Next we are changing the label of the address control (rendered as the control name + “_lbl”).  We are making the label appear like a hyperlink with the text “Edit Address”. Finally we are adding a client side event to the click action.  This client side action is looking for a button on our form (we have not added it yet) and then is invoking its client side action, which will in turn execute the server side action of the same button (we will add that later too).

Step 2- Add our custom button with a server side click action

I normally will add this button to the toolbar area of the quickform just so it is out of the way and less likely to be removed by somebody who sees the button on the form and does not know what it is.  The important bits about adding the button are as follows:

 

  • ControlID: btnEditAddress
  • Caption: Do Not Delete
  • On the Click Action, add a new C# Snippet Action Item with the following code (this is for the contact view, you would need to change the first line for another entity):

Sage.Entity.Interfaces.IContact con = this.BindingSource.Current as Sage.Entity.Interfaces.IContact;

if(con != null && con.Address!=null)
{
    string Id = con.Address.Id.ToString();
    if (DialogService != null)
    {
        DialogService.SetSpecs(200, 200, 318, 600, "AddEditAddress", "", true);
        DialogService.EntityType = typeof(Sage.Entity.Interfaces.IAddress);
        DialogService.EntityID = Id;
        DialogService.ShowDialog();
    }
}

This code will be called after our client side code runs we added in step 1.  The tricky thing here is we are invoking the edit address quick form which is already on the standard Account and Contact pages because it is used by the Address tab.

Here is what our deployed details page looks like after these changes:

Custom Edit Address on SalesLogix detail Quick Form

 

 

And clicking the label opens the Edit Address Quick Form:

Edit Address Quick Form in Standard SalesLogix

 

 

What's This?
  
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   Saleslogix (now Infor CRM) Web Client- Changing Label Appearances on Quick Forms
 I wrote previously about setting a label's appearance on a quick form using server side code.&n
Posted on Oct 02, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Error Attempting to Save an Entity: "E_FAIL(0x80004005)" in the Infor CRM (Saleslogix) Web Client
We recently had a client that was running into an issue when attempting to create one particular entity i
Posted on Sep 30, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Video: Demystifying Infor CRM (Saleslogix) Updates
Watch it now! If you missed yesterdays demo, "Demystifying Infor CRM (Saleslogix) Updates" ,
Posted on Sep 26, 2014 by Brianna Ojard to The Inbox
 
   Official Infor CRM Acquisition FAQ
What to expect now that Saleslogix is Infor CRM. Like many of you, it will take some time (probably a
Posted on Sep 18, 2014 by Brianna Ojard to The Inbox
 
   Problem with the Clean Build Folders option in Application Architect
On occasion, it becomes necessary to clean out the build folders and deployed website prior to a build/de
Posted on Sep 16, 2014 by Jason Buss to Jason Buss' Blog
 
Comments

 

Adam R. said:

Thank you very much for this post.. I was able to get the alternate form working for both the account detail and the contact detail. However, I also need to do the Add Account / Contact new address forms.. It looks like the smart part is an ASP page and not an editable form.. any tips on this?

Thanks!

October 19, 2012 12:04 PM
 

Kris Halsrud said:

Adam even though the add contact form is a custom smart part the same steps still apply.  If you look at how the account and contact smartparts are deployed to your web site you can see the code equivalent of what you have done following this post.

If you duplicate those same results in the custom smart part for add contact account, you will have the same functionality.

October 19, 2012 1:31 PM
 

Sonal said:

I am applying this customization to a custom form but how do I set the repaint event through code.

Right now the functionality works but my pencil still shows next to the composite address control.

Any help would be truly appreciated.

Thanks!!

December 5, 2013 11:22 AM
 

Kris Halsrud said:

Sonal, You need to set the address control's readonly property to true on the page load event:

Address.ReadOnly = true;

December 5, 2013 12:05 PM
 

Rich Eaton said:

Kris, Great help here. Seems that the onclick event of the label now doesn't fire.. I am trying to use this on the insertContact custom form.. any idea..?

February 5, 2014 10:42 AM
 

Rich Eaton said:

Well managed to get the label to fire, however on the insert contact/account screen I am getting error because there is no Address.Id created yet. How do we go about calling the dialog w/o the id associated?

February 19, 2014 7:58 AM
 

Rich Eaton said:

Has anyone gotten this to work in the Insert Contact/Account form..?

February 19, 2014 7:59 AM
 

Kris Halsrud said:

Yes, it is a bit more involved in getting it to work on the insert form.  The process for launching the dialog is the same (minus passing the address id, as it does not exist) but what we do is to pass a dialog parameter to the edit address screen to say it is an edit to an address for a record not yet created.  On the save click on the edit address screen we check to see if the dialog has that parameter and then if so we dont do the normal save event but instead, based on if it was a contact or account address being invoked set the properties through the relation ship (i.e. contact.Account.Address.Address1 = txtAddress1.Text).  You also then need to add a load event to the edit address screen to see if the dialog was launched from there and if so set the controls to the values stored in the address (i.e. txtAddress1.Text = contact.Account.Address.Address1)

February 19, 2014 8:54 AM
 

Kris Halsrud said:

Rich, I am writing up detailed instructions on the insert account/contact functionality.  Expect it next week!

February 19, 2014 11:04 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register