- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 03:54 AM
Hi,
I've written a Catalog client script for a Record Producer but when i am using the script, the Record is not submitting.
Below is the code present that i am using:-
function onLoad(){
//Type appropriate comment here, and begin script below
g_form.getReference('caller_id', somefun);
var status;
function somefun(req){
if(req.vip=='true'){
g_form.addInfoMessage("inside if");
//g_form.setValue('urgency',6);
//g_form.setReadOnly('urgency',true);
}
else{
g_form.removeOption('urgency',6);
}
}
}
Regarding the two lines of code which are commented right now, if I am removing the comments from any one the line, the Record Producer is not working. Below is the screenshot of the Record Producer after clicking the submit button.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 09:37 PM
Hi Sagar,
Below code worked for me,
function onLoad() {
var caller = g_form.getReference('caller_id', doAlert);
}
function doAlert(caller) {
if (caller.vip == 'true'){
var x = 2;
g_form.setValue('urgency',x.toString());
}else{
var y = 6;
g_form.setValue('urgency',y.toString());
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 04:06 AM
You can not use above code in catalog client script of record producer. Because RP doesn't have access caller_id.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 04:09 AM
line 3 should be
var caller = g_form.getReference('caller_id',somefun);
then when you call the function use
function somefun(caller){
if (caller.vip == 'true').....
either that or use a script include to get the values from the caller you need

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 04:10 AM
i should add... you'd need to add a reference field for the caller to the RP. the above script wont work otherwise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 04:16 AM
Gareth,
At first, I was working with this code only. But with this, the getReference method is not returning any object and not populating the variable. Thats why, using my current code now.