- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 07:52 AM
Hello,
I have a lengthy script that i need to run that I would like to place inside of a script include rather than the record producer script field. I need to call the script include and have access to the record producer variables from the script include. Here is what I have so far, it is not working yet:
Record Producer:
var callScriptInclude = new updateContractChangeField().contractChanges();
Script Include:
var updateContractChangeField = Class.create();
updateContractChangeField.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
contractChanges: function(producer, current) {
var contractName = producer.contract_name;
gs.info('Contract Name: ' + contractName);
},
type: 'updateContractChangeField'
});
As you can see, I am trying to pull the contract_name variable from the producer. This is not working, the logs do not reflect the gs.info()
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 08:01 AM
Your "contractChanges" function has the parameters in its declaration, but you are not passing them in from the RP script. Try:
var callScriptInclude = new updateContractChangeField().contractChanges(producer, current);
Or if you are just dealing with 1 piece of data, just pass it instead of the whole "producer" object. Like:
var callScriptInclude = new updateContractChangeField().contractChanges(producer.contract_name.toString(), current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 08:01 AM
Your "contractChanges" function has the parameters in its declaration, but you are not passing them in from the RP script. Try:
var callScriptInclude = new updateContractChangeField().contractChanges(producer, current);
Or if you are just dealing with 1 piece of data, just pass it instead of the whole "producer" object. Like:
var callScriptInclude = new updateContractChangeField().contractChanges(producer.contract_name.toString(), current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 08:20 AM
I tried the first one:
var callScriptInclude = new updateContractChangeField().contractChanges(producer, current);
the gs.info is showing the following: Contract Name: undefined
any idea on how to fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 08:27 AM
SOLVED: I just left out the 'current' on the record producer and script include
var callScriptInclude = new updateContractChangeField().contractChanges(producer);