How to Hide the Assigned User Column in the Case List when in My CRM context

1 minute read time.

A customer had the requirement to hide the column "Assigned To" from the Case List in the MyCRM menu.

but show it in other contexts like company, person and especially Team?

Note: This would be the same idea for any List called from the My CRM or Team contexts, e.g OpportunityList or CommunicationsList.

If we are using on premise Sage CRM we can solve this quite easily using a Create script on the column we want to hide in the List. I've discussed this before in the article "Using Create Script in GridColumns".

The CaseList system action uses the same List block definition in every menu by which it is included. The same list block (CaseList) is used in the My CRM menu, the Team menu and the Company and Person contexts.

This means that the code used in the Create script on the Assigned To field (case_assigneduserid) has to take into account the different contexts.

The main trick we can use here is that the Team CRM is in the context of the 'Team'. You can retrieve this using CRM.GetContextInfo("Channel", "chan_channelid").

Note: Channel is used for Team because of historic reasons.

We also need to check whether a Person record is in context. A Person will be in context when we are looking at either the Case List in the Person context or in the Company context. This is because a company in Sage CRM has a default Person record associated with it.

The business rule can then be stated as "If the list is in the Context of Team, or Company or Person, then the column should be displayed, but it should be hidden otherwise".

This can be expressed in code as:


if (CRM.GetContextInfo("Channel", "chan_channelid")||CRM.GetContextInfo("person", "pers_personid"))
{
Visible = true;
}
else
{
Visible = false;
}

  • Hey Jeff,

    I found the solution. I used the code below and was able to distinguish between the two screens.

    if (CRM.GetContextInfo("Channel", "chan_channelid").toString() != "")

    {

    Visible = true;

    }

    else

    {

    Visible = false;

    }

  • Hey Richard,

    Thanks for replying. The instance of CRM im using is 7.1h and am working on the opportunity module. I place the code in the case list list block and it just keeps 'assigned to' hidden. When I placed the code below in the create script, I got 'Value = [blank]'. Any ideas?

    Valid = false;

    ErrorStr = "Value = "+ CRM.GetContextInfo("Channel", "chan_channelid");

  • I have just retried this.

    In the admin screens I added a create script to the case_assigneduserid field in CaseList list block.

    if (CRM.GetContextInfo("Channel", "chan_channelid")||CRM.GetContextInfo("person", "pers_personid"))

    {

    Visible = true;

    }

    else

    {

    Visible = false;

    }

    This showed the assigneduserid column in the Team context and in the Company and Person context but hid it within the My CRM menu.

    This worked as expected.

    You can test the available context info using the script

    Valid = false;

    ErrorStr = "Value = "+ CRM.GetContextInfo("Channel", "chan_channelid");

    I hope this helps.

  • Jeff,

    I used the script you provided and its not working. The "assigned to" column just stays hidden for both MyCRM and TeamCRM. I tried printing to screen "Valid = false; ErrorStr" for CRM.GetContextInfo... and its not printing anything. When I tried "if (crm.getcontextinfo(...) != null)" it proves that its not null because the column is visible for both MyCRM and TeamCRM. Can you provide me with what value is in there? I tried 'Team' and that didn't work either.