Link to home
Start Free TrialLog in
Avatar of kflorian
kflorian

asked on

Update a custom field in MS CRM 4.0

I am running MS CRM 4.0 Online version.  I want to get the unique id for each instance of the various entities but these are not displayed or accessible in the default interface.  It is acceptable to me to create a new "shadow" field that will hold the GUID for, say, a specific lead record.

Ideally, I could achieve two things.

1.  This value would be set at the time the record is created
2.  I could find a way to set this value for already extant contacts (accounts etc).

What options do I have and what is wrong with the code below?

// my custom field is called aginity_extractedid, where the word "aginity" is the prefix that gets 
// added automatically by crm 4.0.  I've tried to set the value of this field in the OnSave event.  While 
// I am able to access the ObjectId, per the code below, my custom field does not update
 
crmForm.ExtractedId = crmForm.ObjectId;

Open in new window

Avatar of gregowens
gregowens
Flag of United Kingdom of Great Britain and Northern Ireland image

Your code should read as below:

What are trying to achieve - simply to display the record Guid to the end user of the form?

crmForm.all.aginity_extractedid.DataValue = crmForm.ObjectId;

Open in new window

Avatar of kflorian
kflorian

ASKER

This is a step in the right direction.  Thank you.

It doesn't matter if the user sees it.  What I ultimately need is to export the value by placing it in a regular CRM view.

Now that I have it working at the onsave level, is there any way to batch update all records of a given entity type?   Again, I am working in an online version so I do not have direct access to the sql tables.
Sorry, but to be clear - your ultimate aim is to export the data from CRM along with the Guid? Is this to be a one-off or regular? Also is ongoing maintenance of the view you mentioned a key requirement or just a means to an end?
Ultimate aim is to have access to the unique ID for whatever entity for permanent access in view(s)  I will use the id as the linkage between two or more entities in excel tables....to generate reports that one can't get out of the stock CRM system.

ASKER CERTIFIED SOLUTION
Avatar of gregowens
gregowens
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You asked the right question.  Excellent diagnostics in helping me focus on the solution rather than the implementation.

Well done.

WIth thanks,

Ken
Not sure if this will get seen but...I may have spoken too fast...when I perform the actions shown in the beatnik post, I don't get the GUID.  

I don't know if this makes any difference but I get the web query version of the data query....it doesn't automatically bring back any additional fields, nor do I see a way to add them.
screen
screen.png
From *memory*, I think one or both of the following is true:
  • if you click OK after merely viewing the query definition, the Guid field becomes available at the end of the columnset
  • the Guid column is by default hidden in Excel and needs to be made visible by selecting the columns either side, right-cliking the column headers and selecting "unhide"
:)
Greg,

Thanks for responding again...sorry for closing this out if that was the wrong thing to do.  I tried what you said but I don't get any hidden columns.  The only thing that comes back is whatever was in the underlying CRM view.  I am something of an excel "expert" so I know I'm not overlooking a hidden column in excel at this point.

Perhaps we are dealing with the difference between using the online version of CRM?  The query window shown in the beatnik example is the full ms query that one normally sees in excel.  As far as I can tell, I cannot get access to that because the live excel file created by CRM is a "Web Query".....speculation on my part, however.
I thought it would still be accessible from Excel despite being web query - but i have no experience to back this up since I've never used the CRM Online (Microsoft hosted) version.  The organisation I work for resells the hosted solution, but from our own platform which has some differences with the Microsoft hosted version. This may be one of those differences...
The XLS file you download is, I think, an XML file with an XLS suffix. Open it in your favourite text editor and see if you can see any underlying SQL in there - if it is simply mapping columns from an HTML table via a webpage (this seems plausible on the grounds of needing less security administration), then you may have been right to go with your initial approach. That said, the XML may still be manipulable or contain data that is useful to you. If you SQL in there though, then great - that can be tweaked..
Let me know how you get on!
Greg,

I see this in the xml...the "contactid" is there but manually altering the xml to return it as a column...currently beyond my skillset but we'll see how it goes.


<WebPostString>name%3d%22emailaddress1%22%2f%3e%3cattribute%20name%3d%22modifiedon%22%2f%3e%3cattribute%20name%3d%22jobtitle%22%2f%3e%3cattribute%20name%3d%22contactid%22%2f%3e%3c%2fentity%3e%3c%2ffetch%3e%0d%0a&amp;lay</WebPostString>