openForm syntax

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

12 Jun 2014

What is the proper syntax if I want to use openForm(filename, queryParams) and pass an ID as a query param?


fd.openForm('fd_meetingMinutes_DisplayForm.aspx', ID:9);

fd.openForm('fd_meetingMinutes_DisplayForm.aspx', 9);

With ID as variable: fd.openForm('fd_meetingMinutes_DisplayForm.aspx', ID: myID);


What components are necessary to open a DisplayForm from a different list? and what would the syntax look like?


*Note: the two forms are in different lists!

eedoh
Posts: 37
Joined: Tue Feb 11, 2014

12 Jun 2014

var CRID = 1;//or some other way of getting the id for your list item
fd.openForm('path to the list/list name/DispForm.aspx',{ID:CRID, Source:document.URL});

So to sum up:

1. if the form is on another list, don't forget to specify path to the list (relative, or absolute)
2. I doubt your form is named "fd_meetingMinutes_DisplayForm.aspx", It's probably something like "fd_Item_3205351f-1848-4d32-99da-37fde391ec26_Display.aspx", but you can use generic Sharepoint name "DispForm.aspx", and let forms designer open correct form based on user privileges
3. put your parameters into {}. Separate them with "," if there's more than one

Here's an example:
fd.openForm('../Cost Record Log/EditForm.aspx',{ID:CRID, Source:document.URL});
}

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

12 Jun 2014

Hi,

Please, specify application-relative URL of your form and pass ID in the object:

fd.openForm('/Lists/Custom/DispForm.aspx', {ID: 17})

Open form in a dialog:

fd.openFormInDialog('/Lists/Custom/DispForm.aspx', {ID: 17})

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

12 Jun 2014

You are a Rock Star! Thank you.


My working code:


window.myFunc = function(){


var myID = fd.field('idOfMM').control()._el().text();
var mySource = "https%3A%2F%2Fprivacy%2Esharepoint%2Ecom%2Fsites%2Fmgh%2FLists%2FMeeting%2520Minutes%2FAllItems%2Easpx"

fd.openForm('/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx', {ID:myID, Source:mySource});
}

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

13 Jun 2014

Randomly i start getting this error


Sorry, something went wrong
No item exists at https://private.sharepoint.com/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx?FDSource=https://private.sharepoint.com/sites/mg ... c2bc643d5a. It may have been deleted or renamed by another user.


which is not true.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

15 Jun 2014

It seems you didn't pass the ID, I don't see it in your URL. Please, make sure that myID is not empty in your code:

fd.openForm('/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx', {ID:myID, Source:mySource}); }

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

16 Jun 2014

I verified with an alert, and received the same error


No item exists at https://hidden.sharepoint.com/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx?FDSource=https://hiddenforprivacy.sharepoint.com ... c2bc643d5a. It may have been deleted or renamed by another user.

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

16 Jun 2014

Where should the source come from? This list I am in, or the list of the new form i want to open?

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

16 Jun 2014

No item exists at https://private.sharepoint.com/sites/mg ... c2bc643d5a. It may have been deleted or renamed by another user.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

17 Jun 2014

Please, try to omit Source parameter, pass ID only:

fd.openForm('/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx', {ID:myID});

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests