Catalog variable should be available for limited people

Nani nanee
Tera Contributor

Hi all,

Hope everyone is doing great..

 

Requirement : There is a catalog item variable and an email notification (containing email script which is redirecting the people to catalog item through a link on notification).  So "I need to make this specific variable ReadOnly" to people who are coming through notification... and leave it as it is for those who are coming directly through portal.

 

please add your replies on how I can achieve this.. below are the snaps of notification which containing button and second is catalog variable...

Naninanee_0-1707493293941.png

 

Naninanee_1-1707493329214.png

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Nani nanee,

 

This can be achieved by adding a unique sysparm at the end of the record link in the notification. Eg: ${URI+sysparm_source=fromEmail}

 

You can then use this unique parameter within an onLoad Script (or ideally UI Policy - which is best practice) to set the field read-only state.

 

An example of the syntax for your script:

var fullURL = top.location.href;
var result = fullURL.indexOf("fromEmail");
if (result > -1) {
g_form.setReadOnly('your_field_name', true);
} else {
g_form.setReadOnly('your_field_name', false);
}

 

Remember to ensure this only runs on the specific catalog item etc.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

View solution in original post

3 REPLIES 3

Robbie
Kilo Patron
Kilo Patron

Hi @Nani nanee,

 

This can be achieved by adding a unique sysparm at the end of the record link in the notification. Eg: ${URI+sysparm_source=fromEmail}

 

You can then use this unique parameter within an onLoad Script (or ideally UI Policy - which is best practice) to set the field read-only state.

 

An example of the syntax for your script:

var fullURL = top.location.href;
var result = fullURL.indexOf("fromEmail");
if (result > -1) {
g_form.setReadOnly('your_field_name', true);
} else {
g_form.setReadOnly('your_field_name', false);
}

 

Remember to ensure this only runs on the specific catalog item etc.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

Hi Robbie, thanks for the response..&
Where this " Eg: ${URI+sysparm_source=fromEmail}" should be added email script or notification itself?

Hi @Nani nanee,

It all depends on the makeup of your notification and where you are providing the link.

Do you have an email script? 

Essentially, wherever you are providing the link currently (which can be either in the notification itself or via an email script called from within the notification), that's where you need to add the additional parameter of '+sysparm_source=fromEmail'.

 

I provided the example of '${URI+sysparm_source=fromEmail}' as '${URI} is typically used to pass the link to the record from a notification.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Robbie