how to change relationship form value

hi,All


I set "Open Related Form" on [relationshiptype] so that I can edit the relationship with a popup window when I click "Add Relationship".

But I want to bring out the default values in the popup window, I tried the following actions

//my code

//This is the code I tried to write in JavaScript

if ("" === this.getProperty("requ_name",""))
{
   var UserId = this.getInnovator().getUserID();
   if (UserId)
   {
      //User
      UserId = UserId.substr(0,32);
      var User = this.getInnovator().getItemById("User", UserId);
      if (User.getItemCount()==1)
      {
         this.setProperty("requ_name", User.getAttribute("id"));
         this.setPropertyAttribute("requ_name", "keyed_name", User.getProperty("keyed_name", ""));

         // The first way ,but it responds with this message { "undefined" : "document.getElementById(...) is null" }
         document.getElementById("requ_name").value = User.getProperty("keyed_name", "") ; 
         handleItemChange("requ_name", document.getElementById("requ_name").value);

         // Second way, but it responds with this message { "undefined" : "handleItemChange is not defined" }
         handleItemChange("requ_name", User.getProperty("keyed_name", ""));
         //document.thisItem.setProperty("requ_name", User.getProperty("keyed_name", ""));

         // The third way, but it responds with this message { "undefined" : "document.getElementsByName(...)[1] is undefined" }
         var vid=document.getElementsByName("requ_name")[1].id;
         document.getElementById(vid).value = User.getProperty(“ keyed_name”,“”); document.thisItem.setProperty(“ requ_name”,User.getProperty(“ keyed_name”,“”)));
               

      }

   }

}

Please advise me.

Thank you.

  • You can use the $appends property to append a custom field and make it behave as though it's part of your model: Rename your relationship Official Website

  • Microsoft SQL Server in computer is a relational database management system (RDBMS) that supports a wide variety of transaction processing, business intelligence and analytics applications in corporate IT environments. Microsoft SQL Server is one of the three market-leading database technologies, along with Oracle Database and IBM's DB2.

    Like other RDBMS software, Microsoft SQL Server is built on top of SQL, a standardized programming language that database administrators (DBAs) and other IT professionals use to manage databases and query the data they contain. SQL Server is tied to Transact-SQL (T-SQL), an implementation of SQL from Microsoft that adds a set of proprietary programming extensions to the standard language.