[英]Jscript CRM Return Value
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 因此,如果我调用传递给它的字段名称参数的第一个函数,然后我想调用传递第二个字段名和get函数返回值的set函数
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 谢谢
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;
}
Ok with the help of glosrob(Thank you very much); 好吧,在glosrob的帮助下(非常感谢);
i Created a new function called JoinFunctions 我创建了一个名为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 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.