3 Replies Latest reply on Nov 10, 2016 9:38 AM by RMacha

    API Call to create notes in Opportunities, Projects, Cases

    RMacha Apprentice

      Is there an API call similar to "WriteContactNotes", which writes notes to main contact records, that can be used to create similarly structured note records for Opportunities, Projects, and Cases?

        • 1. Re: API Call to create notes in Opportunities, Projects, Cases
          RMacha Apprentice

          Technically, the API doesn't include this function among the XML functions, but in the past I have had success intuiting them from Name/Value Pair functions.  Maybe WriteContactNotes doesn't exist for XML, but just in case I've tried it and included example syntax below.  Also, to create non "C1" records, I've decided on a workaround:  Create the main contacts note, and then change RecID and RecType separately.

           

          However, still running into the problem that this function does not create a Notes record.  Here is my code: 

           

              sXML = GMUI.ExecuteCommand("<GMAPI call=""WriteContactNotes"">" & _

                          "<data name=""Notes"">Hello World</data>" & _

                          "<data name=""AccountNo"">99072735411(DK/7\Rob</data>" & _

                          "<data name=""UserID"">" & "ROB" & "</data>" & _

                          "</GMAPI>")

           

          I get the same fail result whether I include the "UserID" line or not, or replace it with "RecID" and value of "".  Here is the result set:

          <GMAPI call="WriteContactNotes"><status code="-31703">The call passed was not recognised as valid.</status></GMAPI>

           

          The API doc for name/value pairs shows the AccountNo parameter twice (before and after a page break), but I assume they just repeated it rather than overwriting something I need. UserID is supposed to default to the current user, but just for testing I included it above.  Does anyone have XML syntax that works for WriteContactNotes?

          • 2. Re: API Call to create notes in Opportunities, Projects, Cases
            DCastell Expert

            This works:

             

            <GMAPI call="WriteContactNotes" SessionID="1"><data name="RecID">BBB12F1!{2)KH?$</data><data name="Notes">Hello World</data><data name="UserID">DOUG</data></GMAPI>

             

            I believe you could use AccountNo instead of Recid.

            • 3. Re: API Call to create notes in Opportunities, Projects, Cases
              RMacha Apprentice

              Ok, Doug, that's embarrassing.  WriteContactNotes does indeed work if you include SessionID, as I didn't originally, and if you use the GoldMineData object instead of GMUI.  Thanks very much for verifying that it works in XML, so I could troubleshoot with some confidence.

               

              For anyone interested in the outcome regarding the original post, I have succeeded in creating OP, PR, CA (Case), and CR (Case Resolution) notes by following three steps:

              1. Using WriteContactNotes, create a Main Contact Tab note.  (You must have accountno or recid of the Contact1 record)

              2. Get the Recid of the new record from the return data from WriteContactNotes

              3. Using DB_QuickReplace and the new RecID captured in #2, change the RecType to the desired type and change the LOPRECID to that of the associated OP, PR, or case record.

               

              By the way, this means MMUpdater can now be used to add notes to the main GoldMine notes tab, Opportunities, Projects, and Cases from any spreadsheet that contains the target record to link to.  Demos by request.

              2 of 2 people found this helpful