Hello everybody!!
I have a question with this method:
Xrm.Page.data.process.setActiveStage(stageId, callbackFunction);
I'm triying use it, but I can't used it (I don't know where is my mistake).
Notes:
*I use console.log to know the StagesId, it don't be in the final code.
*I don't know if it's okay, but I made a select box field (estado) that will be in
the Stages (1-2-3-4-5), my idea is that the user will select a status process (estado)
like "Hold On"(Frozen Process with little waiting time),"Postergado"(Frozen Process with high waiting time)
or "Lost Opportunity" (Maybe a competidor won or the client abbandond the proyect) and with
this status, the process move to the stage (Hold On --> Stage 8- Hold On).
-If you considering that use a select box tell me the reason. I only have 2 day with Js
I don't know much.
-For my asking, would you explain who use the method? And what is the callbackFunction,
I didn't get any example/information about it in Internet.
-Sorry for my english in sometimes and Thanks for your Time! ^^,
I left my actual code:
function Move(){
// Definir Booleano respecto a moveToNext
var moveToNext = true;
// Para adquirir información del Stage activo del proceso.
var activeStage = Xrm.Page.data.process.getActiveStage();
// Para adquirir la colección de Stages del proceso.
var activePathCollection = Xrm.Page.data.process.getActivePath();
// Para adquirir el Stage actual
var StageSelect = Xrm.Page.data.process.getSelectedStage();
//Para adquirir el nombre del Stage actual
var StageName = StageSelect.getName();
// Para adquirir el ID de la Stage actual
var idstages = StageSelect.getId();
// Xrm.Page.data.process.setActiveStage(stageId, callbackFunction);
//----------------------Revisar el Salto Que NO SALTA! Move not ev al 1:1--------------------------------
// -------- En un momento solo dio error de "CallbackFunction" Undefined-------
//Creamos el Obj para el Estado
var estadObj = Xrm.Page.getAttribute("mk_estado_op").getOption();
//Creamos la Var que almacena los estados posibles
var estado = Xrm.Page.getAttribute("mk_estado_op").getOptions();
// Crearemos la Var que registra el Estado seleccionado
var estados = Xrm.Page.getAttribute("mk_estado_op").getSelectedOption();
// Vamos adquirir el Texto del estado
var estadotxt = Xrm.Page.getAttribute("mk_estado_op").getText();
// Condicionamos el estado
if (estadotxt === "Hold On"){
//Según me informaron en el foro, se usa esta: Xrm.Page.data.process.setActiveStage(stageId, callbackFunction);
Xrm.Page.data.process.setActiveStage("757da4d7-bc58-c063-2ede-1291171cbc6d", function)}
//-----------------------------------------------------------------------------
// Condicionemos el proceso para fase 1-5
if (StageName === "Etapa 1- Identificar Prospecto"){
console.log(idstages);
var backstage = Xrm.Page.data.process.getSelectedStage();
var manic = Xrm.Page.getAttribute("mk_manact_inicial").getValue();
var reuini = Xrm.Page.getAttribute("mk_reunion_inicial").getValue();
if((manic == false) ||(reuini == false) ){
moveToNext = false;
}
if (moveToNext) {
//Move to the next stage
Xrm.Page.data.process.moveNext();
}
}
if (StageName === "Etapa 2- Reconocer Necesidades"){
console.log(idstages);
var backstage = Xrm.Page.data.process.getSelectedStage();
var manac = Xrm.Page.getAttribute("mk_manact_actualizado").getValue();
var whois = Xrm.Page.getAttribute("mk_who_is_who").getValue();
var cust = Xrm.Page.getAttribute("mk_customer_need").getValue();
var spin = Xrm.Page.getAttribute("mk_spin").getValue();
if (( manac == false) || (whois == null) || (cust == null) || (spin == false)){
moveToNext=false;
}
if (moveToNext) {
//Move to the next stage
Xrm.Page.data.process.moveNext();
}
}
if (StageName === "Etapa 3- Evaluar Alternativa"){
console.log(idstages);
var backstage = Xrm.Page.data.process.getSelectedStage();
var ppremi = Xrm.Page.getAttribute("mk_propuesta_premilinar").getValue();
var vulne = Xrm.Page.getAttribute("mk_vulnerabilidad").getValue();
var currents = Xrm.Page.getAttribute("mk_current_situation").getValue();
if ((ppremi == false) || (vulne == false) || ( currents == null)){ moveToNext=false;
}
if (moveToNext) {
//Move to the next stage
Xrm.Page.data.process.moveNext();
}
}
if (StageName === "Etapa 4- Resolución De Aprensiones"){
console.log(idstages);
var backstage = Xrm.Page.data.process.getSelectedStage();
var iapre = Xrm.Page.getAttribute("mk_iaprensiones").getValue();
var fechaec = Xrm.Page.getAttribute("mk_estimated_close_date").getValue();
var rapre = Xrm.Page.getAttribute("mk_raprensiones").getValue();
if ((rapre == false) || (fechaec == null) || ( iapre == null)){ moveToNext=false;
}
if (moveToNext) {
//Move to the next stage
Xrm.Page.data.process.moveNext();
}
}
if (StageName === "Etapa 5- Negociación"){
console.log(idstages);
var backstage = Xrm.Page.data.process.getSelectedStage();
var pfa = Xrm.Page.getAttribute("mk_propuestafinaladjuntado").getValue();
if ((pfa == false) ){ moveToNext=false;
}
if (moveToNext) {
//Move to the next stage
Xrm.Page.data.process.moveNext();
}
}
if (StageName === "Etapa 7- Perdido"){
console.log(idstages);}
if (StageName === "Etapa 8- Hold On"){
console.log(idstages);}
if (StageName === "Etapa 9- Postergado"){
console.log(idstages);}
}
*This post is locked for comments
I have the same question (0)