Hello everybody!
I've a trouble with this script OnSaved, because I need that when "attributeValue" get values:
"null or false" it makes "moveToNext = false".
I've tried with if ((attributeValue == null) || (attributeValue == false)), but when
I'm in the process with this "changed" it don't work (don't move to the next stage with
any value [true or false]).
And when I let only if (attributeValue == null) , it work (move to the next stage), but
can move with any value [true or false], because they not are null.
For example:
Stage 1: Identify Client
var innitialcommunication {1: Si, 0: No} [two option by default]
var customerneed { text lines}
When innitialcommunication == si/true/1 and customerneed != null,
you'll move to Stage 2 when saved.
----------------------------------
function Move() {
//debugger;
//Control var (boolean)
var moveToNext = true;
//gets the stageObject
var stageObj = Xrm.Page.data.process.getActiveStage();
// Returns a collection of steps in the stage.
var stepsCollection = stageObj.getSteps();
//loop on the stepsColletion
for (var i = 0; i < stepsCollection.getLength(); ++i) {
// Returns the logical name of the attribute associated to the step.
var stepAttributeName = stepsCollection.get(i).getAttribute();
// Retrieves the data value for an attribute.
var attributeValue = Xrm.Page.getAttribute(stepAttributeName).getValue();
//if attribute is null set moveToNext to false
if ((attributeValue == null)) {
moveToNext = false;
}
}
// If all attributes contain data
if (moveToNext) {
//Move to the next stage
Xrm.Page.data.process.moveNext();
}
}
----------------------------------------
PD: I'm not a master in JavaScript in CRM, I'm learning, but I've seen somes videos and
I don't get where is my mistake.
For your time Thanks You.
*This post is locked for comments
I have the same question (0)