Reputation: 229
I am looking to pass a parameter from one function to another for example:
function getValueOfAttribute(field1Name) {
var attributeValue = Xrm.Page.getAttribute(field1Name).getValue();
return attributeValue;
}
function setFieldValue(field2Name, attributeValue) {
Xrm.Page.getAttribute(field2Name).setValue(attributeValue);
}
so if i called the first function passing it the field name parameter i want to then call the set function passing the second field name & the returned value from the get function
this is an example of the issue not the actual issue as i have more complex functions but still need to reference the return value.
ideally i want to but don't know if its possible to pass it in the comma separated list of parameters when adding a function.
Any ideas ?
Thank you
Upvotes: 0
Views: 1969
Reputation: 229
Ok with the help of glosrob(Thank you very much);
i Created a new function called JoinFunctions
function JoinFunctions(Join)
{
var resultOfFunc = Join;
}
Calling this from form properties passing the parameter as
FunctionName1(Parameter1, FunctionName2(Parameter2, Parameter3))
For Example:
setFieldValue("fieldname", getFieldValue("firstname"))
Thank you
Upvotes: 0
Reputation: 6715
I'm not sure I follow, but...
I am looking to pass a parameter from one function to another for example:
Well, that is as simple as:
function onLoad() {
var resultOfFunc1 = doSomething();
var resultOfFunc2 = doSomethingElse(resultOfFunc1);
}
function doSomething() {
//do something
return 1;
}
function doSomethingElse(param) {
//do something involving param
return 2;
}
Or even...
function onLoad() {
var resultOfFunc2 = doSomethingElse(doSomething());
}
function doSomething() {
//do something
return 1;
}
function doSomethingElse(param) {
//do something involving param
return 2;
}
Upvotes: 1