I recently had the question how to create an add new functionality on a lookup with skybow Rich Forms.
This is how you can resolve this requirement.
Scenario:
I got a 360 Degrees Staff Feedback list with a lookup to a contact list of persons/staff.
I want to fill out a feedback form, but then I realize that the person I want to give feedback to is still missing in the target list.
I would like to have the possibility to directly add this person on the feedback NewForm and it should be automatically selected afterwards.
How to:
- Start to enrich your NewForm by clicking the Ribbon action
- Add a button with action and place it somewhere next to the lookup field
- Add two actions in the action builder and configure them as follows (Open List Form & Redirect to url)
The url to redirect can be calculated with the power of the skybow Expression Language. We redirect to the current page url by passing an additional parameter (pID). This parameter is dynamically retrieved by a function where we query the person list after adding a new item. The query language is CAML where we get the last person created by me and return the ID:[[@Page.Url]]?pID=[[@Web.GetFirstValueForQuery('Contacts', '<Where><Eq><FieldRef Name=Author LookupId=True /><Value Type=User ><UserID/></Value></Eq></Where><OrderBy><FieldRef Name=Created Ascending=False /></OrderBy>', 'ID')]]
- Final step is to add a form load action to set the person lookup based on the query string parameter (pID) we've passed in the previous step