Before I get back to Sage CRM topics, I wanted to mention an issue I bumped into an issue in a couple of SLX 7.5.1 databases.
Account Type/Subtype combination are generally pretty easy to set up. You just need to create a picklist and name it using the “Code” value for an item in the Account Type Picklist. (For “Lead” for example, create a picklist named “Account Lead” for example). This works fine in most cases, however I discovered that on the insert contact/account screen, it doesn’t quite work correctly.
When you select a type value on this screen, the correct subtype does not come up. If you change type to a different value at that point, you’ll get the sub type list from the first item you selected. Account Type and Subtype show up in three areas; Account Detail, Insert Account and Insert Contact Account. For all three, a business rule called “GetSubTypePickListName()” is called on the LoadAction of the form. This works fine in Account Detail and Insert Account, but not on Insert Contact/Account. To fix this on this view, I wanted to move that business rule from the load action of the form to the ChangedValue action of the Type Picklist itself.
This would be easy to do on the first two forms if it were necessary, since you have an actual view in Application Architect to work with. On the Insert Contact/Account view, you have to modify code within the smart part itself so it gets a little more complicated.
First of all, we need to find the smartpart. This can be found in the Project Explorer under Portal Manager-> Sage SalesLogix-> SupportFiles-> Pages. Right-Click Insert Contact/Account in this area, and click “Edit Page”.
Once the code is open, we basically need to make three changes:
- In the OnLoad method, comment out or remove the line that reads pklAccountSubType.PickListName = account.GetSubTypePickListName();
- In the OnWireEventHandlers method, we need to add a line to include a change action event to the Type picklist control. I threw in a line pklAccountType.PickListValueChanged += pklAccountType_ChangeAction(); under the first line in that method that reads base.OnWireEventHandlers();
- Finally, we need to create the new method we’ve referenced in Step 2. I basically took the code from the OnLoad event, and stripped out everything except the reference to the business rule, and code to set up the Entity objects within that method:
protected void pklAccountType_ChangeAction(object sender, EventArgs e)
IContact contact = (BindingSource.Current as IContact);
if (contact != null)
contact.Account = account;
account = contact.Account;
if (account != null)
pklAccountSubType.PickListName = account.GetSubTypePickListName();
That should be it. Please note, however; that the code I listed above may require some tweaking. (The DB I originally modified is not currently available to me, and I put the code example here largely from memory. I thought I had run into an issue when defining the Account Entity object, so I’ll update this post with the final code once I get a chance to double check what I had originally done.)
Thanks! I hope you find this post helpful. [:)]