fd.field().value() not working


Posted by Felix Müller - Jan 29 ’15 at 03:38


I have a form with an lookupfield called Ticket. I try to set die lookupfield with javascript with the help of a url parameter. My javascrpt is the following:

//check if my custom parameter ParentID is set
var parentID = 5;
if (parentID) {
//parentID is set
var ret = fd.field('Ticket').value(parentID);
//check if the setting was succesful
if (parentID == ret.value()) {
} else {
alert(parentID + " - " + ret.value());

When I open the form with following url (ie. from a related item list) the ticket field is succesfully set:


When I open the form with following url (ie. from a user defined action) the alert box is telling me that setting the value was not successfull.


The only difference between the two URL is the ID parameter in the source parameter.

I see no reason thy it is necessary to have an ID parameter in the source paramter just to do the fd.field('Ticket').value(parentID);

Can you tell me what I did wrong?

  • Dmitry Kozlov
    Dmitry Kozlov
    Member for: 8 years 2 months 15 days
    #1 by Dmitry Kozlov Jan 29 ’15 at 10:42


    I cannot find where you retrieve a query parameter in your code. Please, make sure that the source code of your form page contains the JavaScript you've published here. Most likely that you use fd.getSourceID function to get the parent ID because it extracts ID of the parent item from the Source parameter of the query string.

  • Felix Müller
    Member for: 7 years 8 months 26 days
    #2 by Felix Müller Jan 29 ’15 at 11:56

    Hi Dmitry,

    I simplyfied the code to point the finger to the problem. In my demo code I set the variable statically to 5 which is a valid ID in my testsystem. When I open the form containing exactly the code above with the URLs mentioned above I can see the described behavior.

    The problem seems to be that the value() method somehow runs into an error, when the ID parameter is missing in the source parameter.


  • Dmitry Kozlov
    Dmitry Kozlov
    Member for: 8 years 2 months 15 days
    #3 by Dmitry Kozlov Jan 30 ’15 at 02:46

    [#2]: Could you send HTML-source of your form page to [email protected]?

Displaying 1 to 3 of 3 messages