USD - Scriptlets can they take an argument?

65 views Asked by At

Is there a way to pass an argument to a Scriptlet? So my replacement parameter would be like [[script.scriptname("blah")]] and the scriptlet would be:

function a(b){
  <do something with b>
  return something;
}
a(<string I passed in>)```
1

There are 1 answers

2
Hoffma On

The value of "blah" is almost certainly coming from some other replaceable parameter, correct? If so, just initialize it within the scriptlet function. This is an effective way of "passing parameters" into Scriptlets and script-type Action Calls (RunScript and RunXrmCommand).

function myScriptletFunction() {
    var someVariable = "[[ValueOfBlah]]";
    // Do Stuff with someVariable of "blah"
}
myScriptletFunction();