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

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

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

  • Comments 7
  • Likes

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;
}

Comments
  • On a somewhat related topic, I am trying to set a default value for the Assigned To field within the Status block of a new case but I can't seem to get it working. I went into the Customization section for the field and setup the default to a specific person but when I then create a new case, it doesn't automatically select the person I set as the default.

    Thanks,

    Adam

  • Adam

    This will be because the initial value of the case_assigneduserid is set by one of the workflow actions of the Case Workflow Primary rule.

  • 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.

  • 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.

  • 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");

  • 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;

    }

  • Cool