Forum Replies Created
-
AuthorPosts
-
Just tested hiding the vlookup button. Brilliant!
Alex,
For the snippetfunction vlookupChildAddedCallback(){ var res = spjs.utility.queryItems({ "listName": "DISPLAY_NAME_OF_CHILD_LIST", "query": "<Where><Eq><FieldRef Name='_vLookupParentID' /><Value Type='Text'>"+getFieldValue("_vLookupID")+"</Value></Eq></Where><OrderBy><FieldRef Name='ID' Ascending='FALSE' /></OrderBy>", "rowLimit": 1, "viewFields": ["ID"] }); if(res.count > 0){ var newItemId = res.items[0].ID; setFieldValue("THE_FIELD_YOU_WANT_TO_SET", newItemId); } }
Seems setFieldValue works only if SAVE button clicked on Edit form of the Parent item. Any way to set the field value w/o forcing user click Save?
I redid the whole thing with new lists and sofar prefill is working
I posted 2 replies and none made it to this thread
Alex,
The issue is with vlookup: fields not pre-filling in the Edit form whereas they prefill in the New form, same configuration- This reply was modified 4 years, 3 months ago by Leonid.
Any luck in pointing me to right direction?
Alex, Im emailing snapshots and vLookup config to your gmail.
Im running 4.4.4.23 DFFS Loader with 1.1.19 LookupAlex, the other question came up. I copied vLookup settings from New to Edit form.
Prefill values in child works fine in the New form, but doesnt in the Edit form. Is there some settings that should be adjusted?Got it. I will set the field visible and hide it on form loaded instead. Hope that will work
The only function related to vLookup is:
`function vlookupChildAddedCallback(){
var res = spjs.utility.queryItems({
“listName”: “LCR Answers”,
“query”: “<Where><And><Eq><FieldRef Name=’_vLookupParentID’ /><Value Type=’Text’>” + getFieldValue(“_vLookupID”) +
“</Value></Eq><Contains><FieldRef Name=’FileRef’ /><Value Type=’Text’>” + LCR_ID +
“</Value></Contains></And></Where><OrderBy><FieldRef Name=’ID’ Ascending=’FALSE’ /></OrderBy>”,
“rowLimit”: 1,
“viewFields”: [‘ID’, ‘Title’, ‘FileRef’],
“scope”:”RecursiveAll”
});
if(res.count > 0){
//debugger;
var id = res.items[0].ID;
var title = res.items[0].Title;
setFieldValue(title.replace(” “, “”) + “ID”, id);
}
}and the rule is attached
- This reply was modified 4 years, 4 months ago by Leonid.
Attachments:
Alex,
The button visibility is driven only by the Rule on the dropdown.That worked like a charm!
Im facing sort of rendering issue with multiple vLookups. Sometimes only 1st button shows up. 2nd vlookup button will show if I click the one shown and then close the dialogue
Attachments:
Thanks Alex! To clarify vlookupChildAddedCallback(): Im using folders with vLookup. CAML query should have a recursive scope to go through the folders (?). How this can be accomplished with
spjs.utility.queryItems
Thanks Alex, I will try that! What is the best event to add the code in New form to ensure it fires right after the Child item created?
Followup questions:
I need multiple associations: whats the naming rule for _vLookupID? e.g. _vLookupID1, _vLookupID2, etc.Do I understand correctly that if I use regular item IDs those wont work in Edit form to show proper relationship between Parent and Child. Thus OOB lookup wont work
Continuing with mono- discussion. It appears that ID is not item ID but randomly generated unique ID prior to item creation, and it works. I still need to save child item ID in a parent list because parent list has multiple association with the same child list and reverse ralationship is much simpler.
The other question, whats the best way to make Add Child Record button conditional? E.g. I want to show it only when there is no records in the child list matching query
-
AuthorPosts