I have a Skuid detail page with two models: meeting and invitees. I have a field set for the meeting at the top (for one record whose id is passed in as a parameter) with a related list (table) of invitees below. I have a page title at the top with an action that runs a snippet. In the snippet I’m trying to copy the value of the Subject field from the meeting to all of the invitees, save the meeting and the invitees (as the user may have updated fields everywhere), then redirect to another page. I’m nearly there, but I can’t work out the save and redirect routine. At present the only way I can get it working is for my snippet to do the field copy, then to do the save and redirect in a standard save action, which is obviously a two step process. How can I make the snippet do everything? Here’s the snippet as it stands without the save and redirect: var $ = skuid.$; // Get references to our Models var models = skuid.model.map(); var meeting = models.Meeting; var invitees = models.Invitees; // Select the meeting first row var selectedMeeting = meeting.getFirstRow(); // Set the subject for each invitee from that of the meeting $.each(invitees.data,function(i,row){ invitees.updateRow(row,{ cloupra__Meeting_Subject__c: selectedMeeting.Subject }); }); And here’s a screenshot of the page:
If you add the following lines to your snippet, it should save both models, then do a redirect to /home/home.jsp (which you can of course change):
// Save our Models. Meeting first, then Invitees. // In the callback, // if the Saves all went as planned, // then redirect to another page skuid.model.save([ meeting,invitees ],{callback: function(result){ if (result.totalsuccess){ // REDIRECT to another page // unless there was a problem, // in which case leave the user on the page // so that they can fix it window.location = '/home/home.jsp' } }});
Perfect. Works a treat. Thanks.
Hey Glenn,
I was just searching for an answer how to do what it looks like you already figured out. How were you able to associate invitees to an event? I know it is obviously possible in the regular salesforce with the “add invitees” button, but I am really hung up trying to do this in squid
Hey Jake … we use a custom Invitee object as the standard was too restrictive. It looks up to contact and user, and has a pseudo lookup to the event (not allowed to look up to the standard activity object) that we manage with Apex code. We also have an In We have two Skuid pages: MeetingDetail, where you set the meeting and add invitees in a related list; and InvitationResponse, where the invitee specifies whether they’re attending or not. We expose InvitationResponse to external users through a Force.com Site.
Hope that helps.
Glenn.
Bittersweet news. I wondered if you were utilizing the standard object seeing as I have been having such a hard time with it’s functionality (or lack there of) outside of the standard UI. Back to the drawing board.
Thank you!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.