ResolveGrammarActivity and RequestParameter
Hi,
should a regular ResolveGrammarActivity be able to lookup for [//RequestParameter/attributename] or I have to use my own WF and store new values in WorkflowData during AuthZ stage to use it in emails?
just wanted to send an approval request without AllChangesAuthorizationTable, but only couple of attributes in email template with correct binding names.
AllChangesAuthorizationTable render engine doesn't lookup for overridden display name on attribute binding, so instead of 'My Display Name' it with send 'DisplayName'.
do I have to write something like: foreach (CreateRequestParameter requestParameter in requestParameters)
and save all parameters with _new prefix in WFdata..?
May 31st, 2010 6:47pm
ok, finally decided to cycle through all request parameters and add them to WorkflowData with 'new_' prefix
containingWorkflow.WorkflowDictionary.Add("new_" + requestParameter.PropertyName, requestParameter.Value);
well - it works fine with all string type attributes and [//WorkflowData/new_DisplayName] is resolved correctly in EmaiNotification activity
but all reference values like DisplayedOwner or Manager fail to resolve with Object reference not set to an instance of an object.
I've seen previous post about sending GUID values as string to workflow data but still doesn't understand the right way to put new Manager value into //WorkflowData/new_Manager so it will be resolved correctly with resolveGrammarActivity
used by EmailNotification.
Any ideas?
Microsoft.ResourceManagement.Service: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ResourceManagement.WFActivities.Resolver.GetDisplayStringFromGuid(Guid id, String[] expansionAttributes)
at Microsoft.ResourceManagement.WFActivities.Resolver.ReplaceGuidWithTemplatedString(Match m)
at System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat)
at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator)
at Microsoft.ResourceManagement.WFActivities.Resolver.GetStringAttributeValue(Object attribute)
at Microsoft.ResourceManagement.WFActivities.Resolver.ResolveEvaluatorWithoutAntiXSS(Match m)
at Microsoft.ResourceManagement.WFActivities.Resolver.ResolveEvaluatorForBodyWithAntiXSS(Match m)
at System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat)
at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator)
at Microsoft.ResourceManagement.WFActivities.Resolver.ResolveBody(String input)
at Microsoft.ResourceManagement.Workflow.Hosting.EmailNotificationServiceImpl.ResolveMailMessage(Guid requestId, Guid targetId, Guid actorId, Dictionary`2 workflowDictionary, String toLine, Guid emailTemplateIdentifier, EmailResolutionOptions options, String& failedToResolvePrincipals)
at Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity.ResolveMail(Object sender, EventArgs e)
Free Windows Admin Tool Kit Click here and download it now
June 1st, 2010 6:20pm
Having exactly the same problem ...but just noted the tail of
this thread which says the ResolveGrammarActivity isn't a supported API!!! I know I had this working prior to update 1, because the components I used it for were successfully demonstrated. However it's definitely not working now, and throwing
the same error as above. I posted
this topic on the INT forum (by accident) ... will see what comes back.Bob Bradley, www.unifysolutions.net (FIMBob?)
November 10th, 2010 7:30am
Having exactly the same problem ...but just noted the tail of
this thread which says the ResolveGrammarActivity isn't a supported API!!! I know I had this working prior to update 1, because the components I used it for were successfully demonstrated. However it's definitely not working now, and throwing
the same error as above. I posted
this topic on the INT forum (by accident) ... will see what comes back.Bob Bradley, www.unifysolutions.net (FIMBob?)
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 7:30am
Bob, reference attributes are not a problem.
foreach (UpdateRequestParameter requestParameter in requestParameters)
{
string rpDataID;
if (requestParameter.Value.GetType().ToString().Equals("System.Guid"))
{
rpDataID = "urn:uuid:" + requestParameter.Value.ToString();
if (!containingWorkflow.WorkflowDictionary.ContainsKey("RCnew" + requestParameter.PropertyName))
{
containingWorkflow.WorkflowDictionary.Add("RCnew" + requestParameter.PropertyName, (UniqueIdentifier)rpDataID);
}
else
{
containingWorkflow.WorkflowDictionary["RCnew" + requestParameter.PropertyName] = (UniqueIdentifier)rpDataID;
}
}
else
{
if (!containingWorkflow.WorkflowDictionary.ContainsKey("RCnew" + requestParameter.PropertyName))
{
containingWorkflow.WorkflowDictionary.Add("RCnew" + requestParameter.PropertyName, requestParameter.Value);
}
else
{
containingWorkflow.WorkflowDictionary["RCnew" + requestParameter.PropertyName] = requestParameter.Value;
}
}
November 10th, 2010 7:42am
Bob, reference attributes are not a problem.
foreach (UpdateRequestParameter requestParameter in requestParameters)
{
string rpDataID;
if (requestParameter.Value.GetType().ToString().Equals("System.Guid"))
{
rpDataID = "urn:uuid:" + requestParameter.Value.ToString();
if (!containingWorkflow.WorkflowDictionary.ContainsKey("RCnew" + requestParameter.PropertyName))
{
containingWorkflow.WorkflowDictionary.Add("RCnew" + requestParameter.PropertyName, (UniqueIdentifier)rpDataID);
}
else
{
containingWorkflow.WorkflowDictionary["RCnew" + requestParameter.PropertyName] = (UniqueIdentifier)rpDataID;
}
}
else
{
if (!containingWorkflow.WorkflowDictionary.ContainsKey("RCnew" + requestParameter.PropertyName))
{
containingWorkflow.WorkflowDictionary.Add("RCnew" + requestParameter.PropertyName, requestParameter.Value);
}
else
{
containingWorkflow.WorkflowDictionary["RCnew" + requestParameter.PropertyName] = requestParameter.Value;
}
}
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 7:42am
I mean the code above will copy //Target/Manager to
//WorkflowData/RCnewManager and will work later as it should.
November 10th, 2010 7:46am
Legend!!!! Will give this a try straight away. I have been casting the string to a UniqueIdentifier type without the "urn:uuid:" prefix, and this seemed to work at one stage - but I might have been deluded. Today I actually tried using the
Function Evaluator to write "urn:uuid:"+ GUID (as string) ... didn't work, but didn't realize exactly how close I was either! Will let you know how I get on. Thanks a million (in advance!).
Bob Bradley, www.unifysolutions.net (FIMBob?)
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 8:05am
Legend!!!! Will give this a try straight away. I have been casting the string to a UniqueIdentifier type without the "urn:uuid:" prefix, and this seemed to work at one stage - but I might have been deluded. Today I actually tried using the
Function Evaluator to write "urn:uuid:"+ GUID (as string) ... didn't work, but didn't realize exactly how close I was either! Will let you know how I get on. Thanks a million (in advance!).
Bob Bradley, www.unifysolutions.net (FIMBob?)
November 10th, 2010 8:05am
actually the other part of my WF activity fills a dictionary of reference attributes and later resolves display names of these objects using ReadResourceActivity to add them as //WorkflowData/RCNewManager_Name
So, having such WFActivity in a first place in AuthZ activity I can use my own email templates with //WorkflowData/RCnewManager and //WorkflowData/RCNewManager_Name and throw away AllChangesAuthorizationTable
Surely it works to request approval from //WorkflowData/RCnewManager :) and no ResolveGrammarActivity is used
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 8:22am
actually the other part of my WF activity fills a dictionary of reference attributes and later resolves display names of these objects using ReadResourceActivity to add them as //WorkflowData/RCNewManager_Name
So, having such WFActivity in a first place in AuthZ activity I can use my own email templates with //WorkflowData/RCnewManager and //WorkflowData/RCNewManager_Name and throw away AllChangesAuthorizationTable
Surely it works to request approval from //WorkflowData/RCnewManager :) and no ResolveGrammarActivity is used
November 10th, 2010 8:22am
There's a bug in ResolveGrammarActivity, introduced in Update 1, that kills retrieving WF data with the null reference error you see. I've stepped through the code and raised a bug but it's currently going to be in R2 not a QFE or an update.
Part of the problem is the lack of support for ResolveGrammarActivity in custom WF.
I've worked around this with my own ResolveGrammarActivity (dodgy beta code at present) and a "pre-resolve grammar" function that resolves UniqueIdentifiers to strings before passing into ResolveGrammarActivity.
All in all I'd like to see you both raise Premier incidents and push for a QFE though...Let the field speak and notify the PG that the need for generic activities that make use of the dictionary is very important... :)
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2010 3:41pm
Paul, as you and MS said that ResolveGrammarActivity is not officially supported what's the case of raising an incident?
I don't use it anyway...
I would rather push MS on UniqueValidationXPath bug with reference values (which may be caused by ResolveGrammarActivity :) but its more likely that it just a bug in web control)
November 11th, 2010 2:14am
Paul, as you and MS said that ResolveGrammarActivity is not officially supported what's the case of raising an incident?
I don't use it anyway...
I would rather push MS on UniqueValidationXPath bug with reference values (which may be caused by ResolveGrammarActivity :) but its more likely that it just a bug in web control)
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2010 2:14am
Evgeniy ... I am unhappily reporting that implementing the [rpDataID = urn:uuid:" + requestParameter.Value.ToString();] idea didn't work for me today ... so I think that Update 1 has probably broken your code too ... can you confirm?
Ta ...Bob Bradley, www.unifysolutions.net (FIMBob?)
November 11th, 2010 8:05am
nope, I have Update 1 installed and the code above works just fine. it takes new Manager reference from Request in AuthZ stage and asks for an approval.
what's broken for you?
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2010 8:10am
You know... I'm resolving new Manager's name with ReadResourceActivity before asking for an approval (see #2 below).
just remembered - EmailNotificationActivity will not resolve //Workflowdata/RCnewManager correctly, so I'm passing //Workflowdata/RCnewManager_name to my email templates.
So Paul is kinda right - its a bug
but you still need that prefix urn:uuid for an approval activity to work
November 11th, 2010 8:13am
Yep ... and I've just proven that the following 2 lines of code do exactly the same thing, and I had the second, where the following variable declaration preceeds the code:
string uidAsString = "ce9d869f-ad82-4cea-ba3d-0a8c6150b4d4";
UniqueIdentifier myID = (UniqueIdentifier)("urn:uuid:" + uidAsString); UniqueIdentifier myID = new UniqueIdentifier(uidAsString);
In either case I get the null reference error => definite bug :)Bob Bradley, www.unifysolutions.net (FIMBob?)
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2010 8:55am
Paul, Bob
I have sumbitted this bug to our TAM as well as other 2 I have now in my prod.: DN flow and UniqueValidationXpath inability to resolve references from %Attribute_xxx%
will see what they think about it.
November 12th, 2010 3:10am
Paul, Bob
I have sumbitted this bug to our TAM as well as other 2 I have now in my prod.: DN flow and UniqueValidationXpath inability to resolve references from %Attribute_xxx%
will see what they think about it.
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2010 3:10am
Hi Evgeniy,
Can you please e-mail me the incident number when you get a chance?
My e-mail:
paul dot williams at microsoft dot com
I'd also be interested in knowing the incident number of the urn:uuid bug in RCDC validation too.
Thanks.
November 12th, 2010 3:51am
Hi Evgeniy,
Can you please e-mail me the incident number when you get a chance?
My e-mail:
paul dot williams at microsoft dot com
I'd also be interested in knowing the incident number of the urn:uuid bug in RCDC validation too.
Thanks.
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2010 3:51am


