JK.
Jul 26, 2013 12:47
Hi, I found the problem and figured I might share it with you: This is what I think happened: When I delete an account, CRM actually deletes all the contacts for that account first, so when I query CRM during the predeleteaccount plug-in there are no contacts! When the exception is thrown the deletion of the contacts are rollbacked. Quite confusing.
JK.
Jul 25, 2013 14:58
OK, thanks for your time. Have a good evening.
JK.
Jul 25, 2013 14:57
A good way to say thanks? Since marking answer as accepted doesn't really work this time.
JK.
Jul 25, 2013 14:56
Yes, thank you very much!
JK.
Jul 25, 2013 14:55
hmm, true
JK.
Jul 25, 2013 14:54
you know how many upvotes I can give before it will bounce back?
JK.
Jul 25, 2013 14:54
that is the guid of the contact
JK.
Jul 25, 2013 14:53
seems like that cannot be done and throws Business Model Error. I'll read up more on that.
JK.
Jul 25, 2013 14:52
Service.Retrieve("contact", new Guid("3177741D-27BA-DE11-AC0C-0018717A8C82"), new ColumnSet(true));
JK.
Jul 25, 2013 14:52
Not sure if I'm confortable with that, and I'm not going to bother you anymore with this.
JK.
Jul 25, 2013 14:50
I'm not catching your exceptions
JK.
Jul 25, 2013 14:49
But your code is maintained
JK.
Jul 25, 2013 14:47
=)
JK.
Jul 25, 2013 14:47
sry, you meant the last one
JK.
Jul 25, 2013 14:47
If it had been thrown we had seen it
JK.
Jul 25, 2013 14:47
yes but now it wasn't thrown
JK.
Jul 25, 2013 14:46
Why? I can still see the error in the log I guess?
JK.
Jul 25, 2013 14:44
catch (FaultException<OrganizationServiceFault> ex)
{
throw new InvalidPluginExecutionException(
"An error occurred in the " + this.GetType().Name + " plug-in.", ex);
}
JK.
Jul 25, 2013 14:44
Entity contact = Service.Retrieve("contact", new Guid("3177741D-27BA-DE11-AC0C-0018717A8C82"), new ColumnSet(true));
if (contact.Contains("parentcustomerid"))
{
if (contact["parentcustomerid"] != null)
{
var check = contact["parentcustomerid"];
throw new InvalidPluginExecutionException(check.ToString());
}
else
{
throw new InvalidPluginExecutionException("is null");
}
}
else
{
throw new InvalidPluginExecutionException("parentcustomerid not set");
}
JK.
Jul 25, 2013 14:44
try{
JK.
Jul 25, 2013 14:42
I'm not sure the CRM API takes to kindly to that contact
JK.
Jul 25, 2013 14:42
Hmm, Business Process Error again
JK.
Jul 25, 2013 14:35
I really appriciate your time
JK.
Jul 25, 2013 14:35
If we can't get this to an "answer" I'll just upvote 3 of your best answers on other questions
JK.
Jul 25, 2013 14:33
OK, do you know why it can be found in advanced query then?
JK.
Jul 25, 2013 14:32
Business Process Error
JK.
Jul 25, 2013 14:24
Yes, I can find that account
JK.
Jul 25, 2013 14:17
I try that, get back to you...
JK.
Jul 25, 2013 14:16
and I can manage to get results for other account
JK.
Jul 25, 2013 14:16
*It runs as a plugin
JK.
Jul 25, 2013 14:16
It runs a plugin
JK.
Jul 25, 2013 14:16
I clearly see it in CRM and I see the contacts in CRM and the andvance query for this exact comapny works in crm
JK.
Jul 25, 2013 14:15
A service retreive with a hardcoded accountid as parentcustomerid does not work for this accont
JK.
Jul 25, 2013 14:14
Works with other accounts
JK.
Jul 25, 2013 14:14
Did that, no result for this account
JK.
Jul 25, 2013 14:12
So, it MUST be that! =)
JK.
Jul 25, 2013 14:12
hmm, but in the advanced query I use "Parent Customer Equals _thesamecompanyasguid"
JK.
Jul 25, 2013 14:10
The "weird" thing is that the exact same thing works in an advanced query
JK.
Jul 25, 2013 14:10
Yes, that query returned results.
JK.
Jul 25, 2013 14:10
@Guido Preite "Linked to customer" is a field on the contact form where an account can be set as parentcustomerid.
JK.
Jul 25, 2013 14:10
@Guido Preite True. But I see active contacts in CRM having the account as "Linked To Customer" but they don't show up in query results. Suggestions?
JK.
Jul 25, 2013 14:10
It means that the plugin is registered as a "pre-operation" (which implies that the code is executed before the actual deletion of the entity).
 

C#

General discussions about the c# language, Squirrels | gist.gi...
JK.
Oct 4, 2012 09:02
Not for me...
JK.
Oct 4, 2012 08:58
If I declare a and b as volatile. How is it possible that both wins?
JK.
Oct 4, 2012 08:57
for(int i = 0; i < 1000; i++)
{
a = 0;
b = 0;

Thread.Sleep(1000);

Parallel.Invoke(delegate { a = 1; if (b == 0) Console.WriteLine("A wins"); },
delegate { b = 1; if (a == 0) Console.WriteLine("B wins"); });

Console.WriteLine(System.Environment.NewLine);}
 
JK.
Apr 12, 2012 13:39
a kanske
JK.
Apr 12, 2012 13:34
Ta en femte öl och kör ba
JK.
Apr 12, 2012 13:24
Men det är sant, men hade mycket i tankarna
JK.
Apr 12, 2012 13:23
Du är ju snäll
JK.
Apr 12, 2012 13:23
Men det bar ju inte du