InsertingGoldMine Notes using SQL Stored Procedure

BrianFord
BrianFord used Ask the Experts™
on
I'm running GoldMine 6.7 using SQL Server as the back-end

I need to add Notes to a contact record from with a Stored Procedure.

I have the GoldMine API's and there is a module called GMW_WriteContactNotes which is supposed to do this but I can't figure out how to use it.

According to the documentation the syntax is: EXEC GMW_WriteContactNotes @gmnv

I need to pass the acctno and the notes into this, does anyone have any examples??


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
GMGeniusSoftware Development Manager/Developer

Commented:
Hi BrianFord,
Here is the documentation snippet you need
GMW_WriteContactNotes
            Write notes, including the required notes header, to a contact record.  Recid or Accountno can be passed to identify the record, although, RecID is the preferred method of identifying the record.
Syntax: EXEC GMW_WriteContactNotes @gmnv
Parameters:
@gmnv:  GMNV containing required and optional name/value pairs
Required NV’s:
User
The user scheduling or making the change to the activity.  If the USERID NV is not passed (the user the activity is to be scheduled for) then the activity will be scheduled for the USER NV.  
Notes
The notes to be added.  Cannot exceed 255 characters.
Optional NV’s:
RecID
The RecID of the record to be modified.  
Accountno
Accountno of  Contact1 record
UserID
Username to be placed in Notes header if different than User
Return Status:
-120
An invalid @gmnv parameter has been passed.  Be sure to use sp_CreateGMNV and sp_GMNVSetValue before calling sp_WriteSchedule
-130
The required NV User was not passed.
-170
Both Accountno and RecID were not passed.  At least one of these must be included in the gmnv.
-180
The RecID or accountno passed does not exist in contact1

Author

Commented:
thanks, I have that but I'not sure how to setup the NV pairs, do you have any example T-SQL code?
Software Development Manager/Developer
Commented:
Hi,
This is not tested as I do not have the stored proceedures but i think it will work
 

declare @gmnv varchar(20)

EXEC GMW_NV_Create @gmnv OUTPUT
EXEC GMW_NV_SetValue @gmnv, 'USER', ‘MASTER’
EXEC GMW_NV_SetValue @gmnv, 'NOTES', ‘This is a note that will be added’
EXEC GMW_NV_SetValue @gmnv, 'ACCOUNTNO', ‘A90....’  -- Accountno Of CONTACT1 record
 
EXEC GMW_WriteContactNotes @gmnv
EXEC GMW_NV_Delete @gmnv 

Open in new window

CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

Commented:
Thank you, this works great, the note gets entered but I do get the following message returned

The 'GMW_NV_SetValue' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead.
Have you seen this before?
GMGeniusSoftware Development Manager/Developer

Commented:
Which line does it show that error?
I have not used the Stored Proceedures myself as I tend to create applications in VB for them

Author

Commented:
It's one of the SetValues but I'm not sure which. Buit I will continue to troubleshoot.

The good news is that everythng seems to get entered just fine and the SP does not throw an error, so for now I'm happy to work with it.

Thank you again for your help, very much appreciated :)
GMGeniusSoftware Development Manager/Developer

Commented:
Do you have a MASTER user , possibly this is the issue, also make sure the speach marks are real speach marks  '  i noticed after my posting they show ` not '
 
 

Author

Commented:
thanks, I did correct the the speech marks :)
I'll double check the user

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial