Cannot use getReference method on client script , Glide ajax is the other way

Rahul84
Tera Contributor

Hi @Ankur Bawiskar /Team,

Facing one challenge to use getReference method on client script. I know the other way is to use Glide ajax call.

But I have a display business rule and have a g_scratchpad variable. 

I am having reference field "abc" on a table on which my onLoad client script is written and this "abc" field refers to other field that is having a manager field. I want the value of this manager field and needs to compare this with my g_scratchpad variable.

Pls let me know how can I use this on my client script instead of getRefernce. If Glide ajax is the way so pls provide me the logic and script for reference , how can I call my display BR on client script.

Thanks

21 REPLIES 21

g_scratchpad stores owned by from u_service_offering

Now you need to check what's your requirement and with what value you should compare it

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Abhijit4
Mega Sage

Hi Rahul,

If you already have display BR then you can get both current logged in user manager details as well as service offering manager value in display BR and check if both are same and store comparison result in scratchpad object. The comparison result stored in scratchpad object you can access in client script then perform your further operation.

Let me know if you have any further queries.

Please mark this as Correct or helpful if it helps.

Thanks and Regards,
Abhijit

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Rahul84
Tera Contributor

Hey Abhijit,

Thanks for replying.

Can you pls share the logic here that you are talking about. It will be great for the reference..

I can see your attached script. In both client script and BR you are trying to store same value, why?

If you are storing Service Offering Owner(manager) in scratchpad then why you are trying to get same value through get reference in client script.

Your making some confusions with your requirements.

Could you please eloborate wht you would like to do with Service Offering manager value in client script?

Thanks and Regards

Abhijit

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Rahul84
Tera Contributor

Okay Abhijit, if I will store my current logged in user details and service offering manager details in the display BR.

Then how I can use that scratchpad variable in the onload client script to make the desired field editable to only the service offering manager. For others it will be read only..

" Clear requirement is : I have a "abc" field on a form which will be only editable to the service offering manager , for others it should be read only . I have tried via ACL also but it did not works , so now want to give a try via scratchpad variable.

I have stored the service offering manager in the below scratchpad. Now pls let me know how can I use it in the client script so that particular field is only visible to the offering manager..

g_scratchpad.SOM = current.u_service_offering.owned_by;

 

Can you pls help me with the logic and syntax that I can use in client script for the above requirement...