Skip to main content
Nintex Community Menu Bar

This is a continuation of this thread, but a separate problem.

Here’s my code (thanks for your help, Pat!)


var model = argumentst0].model,&nbsp; &nbsp; row = argumentst0].row,&nbsp;<br>&nbsp; &nbsp; $ = skuid.$,<br>&nbsp; &nbsp; dfd = new $.Deferred();<br>var mA = skuid.$M('AllAppointments');<br>mA.createRow({additionalConditions:s<br>&nbsp; &nbsp; &nbsp; &nbsp; {field: 'Start__c', value: row.Start__c},<br>&nbsp; &nbsp; &nbsp; &nbsp; {field: 'End__c', value: row.End__c},<br>&nbsp; &nbsp; &nbsp; &nbsp; {field: 'Room__c', value: row.Room__c}<br>&nbsp; &nbsp; ]});<br>&nbsp; &nbsp;&nbsp;<br>model.deleteRow(row);<br>$.when(mA.save())<br>&nbsp; &nbsp;.done(function(){<br>&nbsp; &nbsp; &nbsp; &nbsp;var rA = mA.getFirstRow();<br>&nbsp; &nbsp; &nbsp; &nbsp;mA.setCondition(mA.getConditionByName('ThisOne'), rA.Id);<br>&nbsp; &nbsp; &nbsp; &nbsp;$.when(mA.updateData())<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .done(function(){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dfd.resolve();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .fail(function(){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log('something went wrong on query');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dfd.reject();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br>&nbsp; &nbsp;})<br>&nbsp; &nbsp;.fail(function(){<br>&nbsp; &nbsp; &nbsp; &nbsp; console.log('there was a really bad problem, like connecting to the server');<br>&nbsp; &nbsp; &nbsp; &nbsp; dfd.reject();<br>&nbsp; &nbsp;});<br>return dfd.promise(); 



I’m running this little beauty before a calendar popup.

However, the popup displays before I get to the first .done (and it has a whole bunch of row s, because the condition hasn’t been set yet).

Any idea what might be going on here?


To back up a bit, for those interested in the context (perhaps there’s a better way to do this whole thing).

I have two (relevant) event sources. One is a model for our master schedule, and one is a model for recurring events created based on that schedule. The latter basically only has fields for Start__c, End__c, and Room__c (the grouping field). I want to give the users same experience whether they click on an event that is in the Schedule model (AllAppointments above) or the Reoccurrence model. So, what this code is doing is getting the data from the row in Reoccurrence and creating a new row in AllAppointments instead. Then I’m showing the same popup on the AllAppointments model. But I need to be able to narrow down the model to just the fields for the row I created.

Does that make any sense?

Is there a better way to ‘combine models’ into one event source?

thanks!

Check the console for messages from snippet.


This is because currently the “Run Snippet then show custom Popup” Event Source On-Click Behavior for Calendars doesn’t check for a Deferred promise being returned, the way that the Action Framework does. Makes total sense that it would do this. I’ll mark it as an idea — this can probably make it into an upcoming patch release. I’ll keep you updated when this is implemented.


thanks, Zach. Will something be out in the next week, or can you suggest a work-around? Is there another way to accomplish the objective?


This will be made available as part of the next patch release, 6.8.13+


Thanks, Zach! Can someone shoot me a note when the patch comes out?


Hi Matt, we have released Skuid Superbank Patch 5, which implements this. It’s available from Skuid Releases: http://www.skuidify.com/skuidreleases


Thanks! You guys rock.


I know this is an old thread but is there a way to prevent the popup from showing up at all.  What I mean is, can the popup show up on certain conditions but not show up on others.  I want to be able to cancel the addition of a new event under certain circumstances that the snippet will determine but allow other to continue.

Thanks.


Not sure if it will work, but you can try making the snippet return false when you don’t want to show the popup.