We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Update a custom field in MS CRM 4.0

kflorian asked
Medium Priority
Last Modified: 2012-05-06
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

Watch Question

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


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.

ok, in that case can i suggest a different approach. Take a look at this blog posting which suggests using dynamic query in Excel then manipulating the underlying SQL.
I've used this good effect in a number of deployments.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


You asked the right question.  Excellent diagnostics in helping me focus on the solution rather than the implementation.

Well done.

WIth thanks,



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.


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"



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!



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.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.