Skip to main content

I was having trouble with getting a button to render correctly after having an action on another component update a field, so I decided to use a Branch to run a “Validation” before continuing. However, the Branch only works if I don’t add any actions to the branch. As soon as I add an action it ignores the branch and does the “Else” actions which I don’t want it to do.


Figure 1 is without an action on the branch.


When I have it like this and I click “Next Step” it works correctly, but as soon as I add an action to the branch using the “Add If-True Action” button, it skips the branch (even know it’s still true) and does the “Else” actions.


Hard to show the problem without recording the Wizard that its performing on. But, I can’t see any logical reason as to why it would skip the Branch when I don’t change the formula at all and just add an action.


Anybody else have this issue?

Hey Sam. Sorry this is being a struggle.

Would you mind copying and pasting in the XML for us to look at?


Here’s the XML without an IF-True Action to where it doesn’t continue, but once I add an If-True Action to update the UI-Only field called BOMDeductionError (Under Receiving model) to true, it just goes to the Else statements of the branch.


The BOMDeductionError field controls the rendering of the template above the Wizard to stop the user from continuing until Receiving.BOMsDeducted = true. Which is activated in the ValidateBOMDeductions snippet… from the “Pick” button under “Deduct From Inventory” row action. This page kind of turned into a mess with all the different functions and validations I have to perform.


I believe I found a way around it, but I’m pretty sure this is a bug within Skuid as I don’t see any reason the branch shouldn’t work whenever I add an If-True action to it.


















{{Total_Qty_Received0__c}}


{{$Model.POLineItemSelect.data.0.Quantity_Recieved__c}} + {{TotalQtyReceived}}








{{Total_Qty_Received0__c}}


IF({{BOMsDeducted}} == false && {{DeductBOMs}} == true,true,false)



















row.updated


Total_Qty_Received0__c










































IF({{Quantity_Requested__c}} - {{Quantity_Recieved__c}} == 0,"",{{Quantity_Requested__c}} - {{Quantity_Recieved__c}})






On Order
New















row.updated


NonInventoryQty








{{NonInventoryReceiveAll}} == true





row.updated


NonInventoryReceiveAll












































{{Quantity_Received__c}} + {{$Model.Receiving.data.0.TotalQtyReceived}}






















































New
In Process






























&nb

Qty To Rec



Reference Note


































POLineItems

ReturnLines





POLineItems

ReturnLines















<p><u><strong>Toggle Filters</strong></u></p>



































PO No



Part & Rev

{{Part__c}}{{#Part__r.Revision__c}} Rev {{Part__r.Revision__c}}{{/Part__r.Revision__c}}




QTY Req



Qty Rec



Qty Rem



Non-Inv- Rec Remaining







Qty To Rec
















Receiving

PartLookup

SerialNumber

PartBOMs





Receiving

PartLookup

PartBOMs









PartLookup

POLineItemSelect

PartBOMs
















Part & Rev

{{Part__c}}{{#Part__r.Revision__c}} Rev {{Part__r.Revision__c}}{{/Part__r.Revision__c}}



&nbs


Reference












<p style="text-align: center;"><u><span style="font-size:16px;"><strong>Quick BOM Deduction</strong></span></u></p>




<b>Select</b> <div class="nx-skootable-buttonicon sk-icon inline nx-skootable-buttonicon-visible fa-cubes"></div> Icon next to <u>BOM(s) of </u> {{Part__r.Name}}to <b>Deduct From Inventory</b>
<br>
<br>
<b><u><font color="Red">All</b></u></font> Required BOM(s) must be deducted from Inventory before continuing.


{{Parent_Part__r.Name}} {{#Parent_Part__r.Revision__c}} Rev {{Parent_Part__r.Revision__c}} {{/Parent_Part__r.Revision__c}} BOM(s)






BOM Part


Unit BOM Req


In Stock


Total Qty Req


Total Qty Deducted







SingleSerialNumberDeductions
SingleSerialNumbers




SingleSerialNumberDeductions
SingleSerialNumbers











{{BOMTotalQty}} {{BOM_Part__c}} Required





Inventory Deduction


<p>(1) Enter qty to deduct from each SSN or click "Select All Available" checkbox to deduct entire SSN qty available</p>

<p>(2) Confirm Qty To Deduct is correct for each selected row</p>


<p>(3) Once Total Required above equals Sum below Qty To Pick, click Pick to deduct parts from inventory</p>







Finally the end!


Also, a separate problem with the Skuid Community posting…


When I paste my code in the comment box, it lets me post all of it


And then it brings me back to the page and it shows all of it…


But, once I reload the page, it shows what actually posted. Which is only part of it and then I have to find where it got cut off and repeat the process.


Now that I know the problem I’m aware, but before this was causing problems when trying to share my code since I thought it was posting it all.


{{$Model.SingleSerialNumbers.data.0.TotalPickedEqualsTotalRequired}} == 1




















<p style="text-align: center;"><span style="color:#ff0000;"><strong>Total picked qty does not equial total required by selected BOM. Adjust "Qty To Pick" and click "Pick" again </strong></span></p>








































{{BOMsDeducted}} == true && {{DeductBOMs}} == true















&n

SerialNumberDeductions

SingleSerialNumberDeductionsToSave













































Global RMA #























Part

{{Part__c}} Rev {{Part__r.Revision__c}}




































ReturnLineSelect
























var params = arguments[0];

var step = params.step;

var $ = skuid.$;


//models

var models = skuid.model.map();

var Receiving = models.Receiving;

var SerialTracker = models.SerialNumber;


//variables

var QtyOfCtns = Receiving.data[0].QTY_OF_CTNS__c;

var TotalQtyRec = Receiving.data[0].Total_Qty_Received0__c;

var QtyPerCtns = (TotalQtyRec / QtyOfCtns);

var Remainder = (TotalQtyRec % QtyOfCtns);

var holder;


for (i = 0; i < QtyOfCtns; i++)

{

var row = SerialTracker.createRow({

additionalConditions: [

{ field: ‘Initial_Qty__c’, value: QtyPerCtns},

{ field: ‘Container’, value: i+1},

], doAppend: true

});

holder = (i+1);

}

if (Remainder > 0)

{

var row = SerialTracker.createRow({

additionalConditions: i

{ field: ‘Initial_Qty__c’, value: Remainder},

{ field: ‘Container’, value: i+1},

], doAppend: true

});

}

var field = argumentsi0],


value = skuid.utils.decodeHTML(argumentsd1]);


skuid.ui.fieldRenderersifield.metadata.displaytype]field.mode;


if (value === true)


{ 

field.item.element.addClass("LeadTab_highlighted-row");


}</jsitem>
<jsitem location="inlinesnippet" name="ValidateSSNs" cachelocation="false">var params = argumentsr0],

$ = skuid.$;


var models = skuid.model.map();

//Models

SSNs = models.SingleSerialNumbers;

Receiving = models.Receiving;

//Page Components

ValidationText = skuid.component.getById(‘sk-2iWPuK-1221’);

ValidationPanel = skuid.component.getById(‘sk-2izgpd-1092’);

//Vars

TotalToDeduct = 0;

//Loop through all rows that aren’t blank &amp; add together

$.each(SSNs.data,function()

{

if (this.Deduct !== undefined)

{

TotalToDeduct = TotalToDeduct + this.Deduct;

}

});

SSNs.data 0].TotalPickQty = TotalToDeduct;

//If qty Picked = BOM Qty Required, continue

if (SSNs.data<0].TotalPickQty == SSNs.data.0].TotalBOMQtyReq)

{

SSNs.data/0].TotalPickedEqualsTotalRequired = 1;

}

//else, give error

else

{

SSNs.data/0].TotalPickedEqualsTotalRequired = 0;

}

//Refresh Page Components with totals and/or errors

ValidationText.conditionallyRender();

ValidationPanel.render();


var params = arguments 0],

$ = skuid.$;

models = skuid.model.map();

//Models

SSNs = models.SingleSerialNumbers;

SSNDeductions = models.SingleSerialNumberDeductions;


//Create a deduction for every SSN

$.each(SSNs.data,function()

{

if (this.Deduct !== undefined || 0)

{

var CreateDeduct = SSNDeductions.createRow(

{

additionalConditions:

{field: ‘Single_Serial_Number__c’, value: this.Id},

{field: ‘Qty_Deduction__c’, value: this.Deduct}

], doAppend: true

});

}

});

var params = argumentsb0],

$ = skuid.$;

//Page Componenets

PartBOMTable = skuid.component.getById(‘sk-2eJJFq-399’);

ReceivingWizardButton = skuid.component.getById(‘sk-3Uw0Eb-228’);

ReceivingFieldEditor = skuid.component.getById(‘sk-1o9c6g-225’);

ReceivingPageTitle = skuid.component.getById(‘sk-3Hukyw-4293’);


PartBOMTable.conditionallyRender();

ReceivingWizardButton.conditionallyRender();

ReceivingFieldEditor.conditionallyRender();

ReceivingPageTitle.Render();

var params = argumentsT0],

$ = skuid.$;

models = skuid.model.map();

//Models

PartBOMs = models.PartBOMs;

Receiving = models.Receiving;

//vars

counter = 0;

Check = false;


$.each(PartBOMs.data,function() {

if (this.QtyReqVSQtyPicked === true)

{

counter++;

console.log(‘QtyReqVSQtyPicked’ + this.QtyReqVSQtyPicked);

}

});

console.log('counter: ’ + counter);

if (counter === PartBOMs.data.length) {

Check = true;

Receiving.data)0].BOMsDeducted = Check;

console.log('Check: ’ + Check);

}

<jsitem location="i


Thank you for posting the XML. The effort that went into it makes me hate to say this
It is very long. It’s also full of custom components which make pressing the preview button difficult on our end. We rarely get a solid reproduction this way. I’m going to attempt to look at it the best I can, but the shorter the XML the better. The less custom parts in the XML, the better.


Unfortunately, when I copy and paste it over:



So for now I’ll just put this here:
https://docs.skuid.com/latest/en/skuid/action-framework/action-framework.html#logic


That has our official documentation on branch logic. Hopefully you’ll find it helpful.


Thanks, I had a feeling it wouldn’t be possible. I will try to narrow down the issue. Thanks for responses. 


No worries. I look forward to the narrowed down version


Hey Sam and Stephen,

Just thought I would take a stab at this and hope that maybe its something silly and it will solve the issue if you are still having it.

2 quick things:

1. Have you right clicked on the page, selected inspect and checked for any errors? Something like “Cannot Merge property of Null” would basically put you dead in the water.

2. Does this button have the context it needs to evaluate this field? I see that you are just using {{FieldName}} (Again, dont have full knowledge given the XML in multiple pieces and the complexity around it). I would look at possibility of using {{$Model.ModelName.data.0.FieldName}} where 0 defines the row index, obviously if that is not possible, then this isnt really helpful. 

2a. Kinda relates to how you set up the branch logic, but you could also try something like IF({{FieldName}} == true,true,false). This way you know for sure that your branch statement is returning true or false and there is nothing that is up for interpretation.

Hopefully this helps (or at least gets you on the right path).

Richard


Thanks Richard. I put this on the back burner for now, but I appreciate you taking a look. I will try to get back to you when I can take a look.


Hi, has there been any updates to this?

I am testing with branches at the moment too and i cant figure out how to trigger the event either.

Will create a new post for this,

Thanks,

Peter


Reply