- 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 07:57 AM
try
var callScriptInclude = new updateContractChangeField().contractChanges(producer.contract_name);
var updateContractChangeField = Class.create();
updateContractChangeField.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
contractChanges: function(producer) {
var contractName = producer;
gs.info('Contract Name: ' + contractName);
},
type: 'updateContractChangeField'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 07:59 AM
Hi - Update script include call as below var callScriptInclude = new updateContractChangeField().contractChanges(producer.contract_name);
Script Include
var updateContractChangeField = Class.create();
updateContractChangeField.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
contractChanges: function(cName) {
var contractName = cName;
gs.info('Contract Name: ' + contractName);
},
type: 'updateContractChangeField'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 08:15 AM
This works for one parameter, but I am going to be pulling 15 variables from my record producer (it is going to be a lengthy script). How can I do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 08:00 AM
Hi,
The function in script include expecting 2 arguments, from the record producer script where you are calling the function, you are not passing anything.
-Anurag