Forum Replies Created
-
AuthorPosts
-
Never mind, I figured it out…
Nevermind – I think I have it… Had to turn off InfoPath
Here is the screenshot of the installer – Clicking the Direct to Backend just opens the form
Attachments:
So I figured it out… here is how to call multiple vLookups to multiple multi-line fields… I had been duplicating the whole code for each vLookup, but it only needs the information in the first function.
function dffs_PreSaveAction() { write_vLookup_to_multiline({ "fin": "vLookupShiftAssignments", // Name of vLookup column #1 "writeTo": "ShiftAssignments", // Name of field to write to "groupBy": "Category_" // Name of field to group by }); write_vLookup_to_multiline({ "fin": "vLookupSecurityInspection", // Name of vLookup column #2 "writeTo": "SecurityInspection", // Name of field to write to "groupBy": "InspectionComplete" // Name of field to group by }); write_vLookup_to_multiline({ "fin": "vLookupContrabandInspection", // Name of vLookup column #3 "writeTo": "ContrabandInspection", // Name of field to write to "groupBy": "Mod" // Name of field to group by }); return true; } function write_vLookup_to_multiline(arg) { var b = [], val, arr = []; b.push("<table cellpadding='4' cellspacing='0' class='vLookupText'>"); // Header row b.push("<tr>"); jQuery.each(spjs.vLookup.dataObj[arg.fin][spjs.dffs.data.thisItemID].fields, function (fin, disp) { b.push("<th valign='top' class='vLookupTextth'>" + disp + "</th>"); }); b.push("</tr>"); // Body - make array of items jQuery.each(spjs.vLookup.dataObj[arg.fin][spjs.dffs.data.thisItemID].items, function (i, item) { arr.push(item); }); // Sort by groupBy field arr.sort(function (a, b) { if (a[arg.groupBy] < b[arg.groupBy]) { return -1; } if (a[arg.groupBy] > b[arg.groupBy]) { return 1; } return 0; }); var groupHeaderTracker = {}; jQuery.each(arr, function (i, item) { if (groupHeaderTracker[item[arg.groupBy]] === undefined) { groupHeaderTracker[item[arg.groupBy]] = true; b.push("<tr>"); b.push("<td style='padding:5px; valign:top; border:none;'>" + item[arg.groupBy] + "</td>"); b.push("</tr>"); } b.push("<tr>"); jQuery.each(spjs.vLookup.dataObj[arg.fin][spjs.dffs.data.thisItemID].fields, function (fin, disp) { val = item[fin] !== null ? item[fin] : ""; val = val.split("<").join("<").split(">").join(">"); b.push("<td valign='top' class='vLookupTexttd' style='" + (i % 2 === 1 ? "background-color:#eaeaea;" : "") + "'>" + val + "</td>"); }); b.push("</tr>"); }); b.push("</table>"); setFieldValue(arg.writeTo, b.join("")); }
- This reply was modified 4 years, 10 months ago by Notrega.
No error… We found the vlookup had to be on the active tab. We fixed the no save issue but still need help with the multiple calls.
Hey Alex – hope your holiday season is going great.
We are successfully using the code above in several lists, but are having issues using multiple instances of the code at the same time. Basically we have a list that has 6 vLookups that we want to write them to multiline fields so that we can eventually archive the vLookup records and still maintain a snapshot of the data in the parent record.
The issue is that we can get them all to work, then some stop working. So we remove 5 and leave one, it works for maybe a few records and then prevents the users from saving the parent record.
Is there a better way to accomplish what we need or different code we can use?
September 11, 2019 at 20:49 in reply to: DFFS does not recognize workflow created list record #27064Hey Alexander – This is working wonderfully with one issue… if somehow the user gets to the point that creating the new record is ready, but gets a Save Conflict error… What happens is when they refresh or cancel the new record is created. They then go back and attempt to enter more information and a second new record is created… sometimes as many as 4-5 depending on how persistent the user is.
Is there anything that can check and see if the record is already there and not create a newer one?
I have the vLookup view grouped and sorted… see the image attached.
What I am wanting grouped and/or sorted is the multiline field that goes in the email, something similar to the vlookup view in the item.Attachments:
Last question – is there way to sort or group the view?
You sir are a fricking genius – THANK YOU!!
Beers on me on paydayChanged field names and still no go, but here is what I got out of Console View –
Attachments:
I can’t seem to get this to work. I followed the directions and changed vLookupTask with my field name vLookupItem and Multiline with my field name Email_Text, but now it won’t let me save the record at all…
Forgot to add – the DateV field is the day# of the year… 6/9/2019 = 160
The DateV is meant to check to see if the ShiftDateV falls between the Start/End DateVWell… my colleague did all the work… I just asked you the questions. LOL
Seriously though it works perfectly and is exactly what we needed.Beers on me Friday (payday)!!!
-
AuthorPosts