Codelessly Making "Inactive" Companies and Contacts Unselectable When Adding a New Opportunity

The Sage CRM Blog

Articles of general interest about Sage CRM, the community, add-ons and general news!

Codelessly Making "Inactive" Companies and Contacts Unselectable When Adding a New Opportunity

  • Comments 1
  • Likes

A business has the requirement that when a new opportunity is created Inactive companies and Inactive Persons should not able to be selected from within the fields of the web-picker.

This is a type of rule that will only need a simple statement, and these is no complex code needed to enforce the business rule.

In the image below you can see that I can select the company Gate Howe BUT this company has been marked as 'Inactive'.

If I go ahead and select the 'Active' company Gatecom, I would be shown the list of persons that includes  'David Costello' who I know is 'Inactive' as in the image below.

Both of the fields above (oppo_primarycompanyid and oppo_primarypersonid) are of the entry type 'Search Select Advanced'.

I can implement my business rule by using a properties of this field type called the 'Search SQL clause'.  You can read more about using this property within the technical articles

To hide the InActive companies I need to add the following SQL clause to the field definition screen for the 'oppo_primarycompanyid' field.


comp_status !='InActive'
 

To make this change, navigate in the System Administration screens to 

Administration -> Customization -> Opportunity

Click on the field oppo_primarycompanyid and change the properties

Adding this clause will only retrieve those companies where the comp_status is NOT set to 'Inactive'.

To hide the InActive person I need to add the following SQL clause to the field definition screen for the 'oppo_primarypersonid' field.


pers_status !='InActive' or pers_status is null
 

Adding this clause will only retrieve those persons where the pers_status is NOT set to 'Inactive'.

Note:  This assumes that you have added the field 'pers_status' into the personboxlong screen so that it is status field is used in the application.

Once these changes have been made, you can see that the 'InActive' companies and persons are excluded:

 

 

Comments
  • Hi Jeff,

    This is nifty.

    Do you know where CRM controls the columns that show in the preview of the results? I like how your Company list includes Company Name and Company Status, and the Person one shows Person and Person Full Number.

    I was hoping it was RelatedPersonsGrid but that didn't work for me.

    Would love any pointers in the right direction.

    Thank you Jeff.

    Arline