MS CRM 4.0 Programming Worlflows in C# for bulk update of customized column.
Hi
I'm a beginner in the C# language, but trying to progamme a plugin using the CRM SDK to be used iin workflow to update a number of Lead records at a given time of the day. I have the basic recurring workflow (created with CRM) that can wait to execute an operation at a specific time, but am struggling slighlty on the C# plug in side..
What I'm trying to achieve;
1. a workflow runs at a given time during the day (e.g. 5pm) (DONE).
2. it updates a column in several records on the lead table, called for example, new_test_field, that I've created. It will only update the column to a value, where the createdon value is set to the current day..
I've create the workflow infrastucture to wait for execution at 5pm, but now struggling with the C# plugin... Downloaded a simlar example from the Web which updates the status on the account entity but was wondering if this can be adapted to update the customized column as I indicated. Example is attached.
In your columnset, instead of adding 'statecode', add 'new_text_field'.
Update the field as needed right before the crmService.Update(acc)-statement and you should be set.
BigBlueMan
ASKER
Hi dijaries
Thanks for the reply....The VS2008 intellisense didn't seem to recognise the new field name, which confused me... I'll try it and build the solution and see what happens.
Dennis Aries
Refresh your web-reference when you alter your entities to incorporate your chances and allow intellisense to work with it.
Thanks for the information.... Tried all that, but still not showing my new attribute... However, have noticed that all my customized columns which are prefixed with 'new_' do not appear anyways...
Apologies but C# is not my tradtional programming language (am from a Perl background)...
In my version of the final foreach loop below, i'm querying lead entitiy.. now I assume as my new columns are in the leadextension table this is why they do not appear.... Is this the issue ???
Any suggestions ?
foreach (lead ld in crmService.RetrieveMultiple(query).BusinessEntities)
{
...
...
}
Dennis Aries
By 'Refresh', I meant 'update' the webservice (rightclick on the webservice-reference and select update).
You are using the information retrieved from the webservice, so you are using the metadata database which should return you all the attributes unless you stated otherwise in your query. This should include the leadextension table.
Since I assume you did update the reference, can you post your query?
BigBlueMan
ASKER
Hi Dijares
Have added a screen print of my environment and the sample code... I've just started to learn C# and am due to get on a course shortly, so apologise again for my ignorance...
Update the field as needed right before the crmService.Update(acc)-statement and you should be set.