.
Showing posts with label CRM. Show all posts
Showing posts with label CRM. Show all posts
Monday, February 25, 2008
Saturday, February 23, 2008
Wednesday, January 2, 2008
Monday, December 17, 2007
Automatically complete a task via a callout
Code:
public void CompleteTask(Guid taskId)
{
SetStateTaskRequest tr = new SetStateTaskRequest();
tr.EntityId = taskId;
tr.TaskState = new TaskState();
tr.TaskState = TaskState.Completed;
tr.TaskStatus = -1 ; // Set this field to -1 to have the platform set the appropriate value
service.Execute(tr);
}
Unfortunately for some unknown reason; completing the task using the above code will cause the workflow (a Sales Process workflow was tested) to end.
public void CompleteTask(Guid taskId)
{
SetStateTaskRequest tr = new SetStateTaskRequest();
tr.EntityId = taskId;
tr.TaskState = new TaskState();
tr.TaskState = TaskState.Completed;
tr.TaskStatus = -1 ; // Set this field to -1 to have the platform set the appropriate value
service.Execute(tr);
}
Unfortunately for some unknown reason; completing the task using the above code will cause the workflow (a Sales Process workflow was tested) to end.
Wednesday, December 12, 2007
Prevent a form from being saved
Tuesday, November 27, 2007
Wednesday, November 21, 2007
Differentiate between contact and account (customerid)
if(opportunity.customerid.type == EntityName.account.ToString())
{
account account = (account)service.Retrieve(EntityName.account.ToString(), opportunity.customerid.Value, new AllColumns());
if(account.revenue != null)
{
opportunity.new_accountvalue = new CrmMoney();
opportunity.new_accountvalue.Value = account.revenue.Value;
}
}
else if(opportunity.customerid.type == EntityName.contact.ToString())
{
contact contact = (contact)service.Retrieve(EntityName.contact.ToString(), opportunity.customerid.Value, new AllColumns());
if(contact.creditlimit != null)
{
opportunity.new_accountvalue = new CrmMoney();
opportunity.new_accountvalue.Value = contact.creditlimit.Value;
}
}
service.Update(opportunity);
{
account account = (account)service.Retrieve(EntityName.account.ToString(), opportunity.customerid.Value, new AllColumns());
if(account.revenue != null)
{
opportunity.new_accountvalue = new CrmMoney();
opportunity.new_accountvalue.Value = account.revenue.Value;
}
}
else if(opportunity.customerid.type == EntityName.contact.ToString())
{
contact contact = (contact)service.Retrieve(EntityName.contact.ToString(), opportunity.customerid.Value, new AllColumns());
if(contact.creditlimit != null)
{
opportunity.new_accountvalue = new CrmMoney();
opportunity.new_accountvalue.Value = contact.creditlimit.Value;
}
}
service.Update(opportunity);
Thursday, November 8, 2007
Another Null Reference Exception CRM
Task post create event:
public override void PostCreate(...)
{
Guid opportunityId = task.regardingobjectid.Value;
this.opportunity = (opportunity)service.Retrieve(EntityName.opportunity.ToString(), opportunityId, new AllColumns());
opportunity.new_textfield = "hello world"; // throws a NullReferenceException
string newtext = "hello world";
opportunity.new_textfield = newtext; // works fine
}
public override void PostCreate(...)
{
Guid opportunityId = task.regardingobjectid.Value;
this.opportunity = (opportunity)service.Retrieve(EntityName.opportunity.ToString(), opportunityId, new AllColumns());
opportunity.new_textfield = "hello world"; // throws a NullReferenceException
string newtext = "hello world";
opportunity.new_textfield = newtext; // works fine
}
Monday, November 5, 2007
CRM Lists links
From
http://sharepointsix.blogspot.com/2007/06/microsoft-crm-30-integrating-crm-into.html
DataGrid Lists
Accounts - http://crm/_root/homepage.aspx?etc=1
Contacts - http://crm/_root/homepage.aspx?etc=2
Opportunities - http://crm/_root/homepage.aspx?etc=3
Leads - http://crm/_root/homepage.aspx?etc=4
Marketing List - http://crm/_root/homepage.aspx?etc=4300
Reports - http://crm/CRMReports/home_reports.aspx
Activities - http://crm/workplace/home_activities.aspx
Calendar - http://crm/workplace/home_calendar.aspx
Articles - http://crm/workplace/home_answers.aspx
Queues - http://crm/workplace/home_workplace.aspx
Competitors - http://crm/_root/homepage.aspx?etc=123
Products - http://crm/_root/homepage.aspx?etc=1024
Sales Literature - http://crm/_root/homepage.aspx?etc=1038
Quotes - http://crm/_root/homepage.aspx?etc=1084
Orders - http://crm/_root/homepage.aspx?etc=1088
Invoices - http://crm/_root/homepage.aspx?etc=1090
Quick Campaigns - http://crm/MA/home_minicamps.aspx
Campaigns - http://crm/MA/home_camps.aspx
Cases - http://crm/CS/home_cases.aspx
Contracts - http://crm/_root/homepage.aspx?etc=1010
Services - http://crm/_root/homepage.aspx?etc=4001
Replace crm for crmdev.mydomain.com or something like that.
Edit:
This links apparently work for the 4.0 version of crm, for example:
Opportunities - http://crm.domain.com/Organization/_root/homepage.aspx?etc=3
http://sharepointsix.blogspot.com/2007/06/microsoft-crm-30-integrating-crm-into.html
DataGrid Lists
Accounts - http://crm/_root/homepage.aspx?etc=1
Contacts - http://crm/_root/homepage.aspx?etc=2
Opportunities - http://crm/_root/homepage.aspx?etc=3
Leads - http://crm/_root/homepage.aspx?etc=4
Marketing List - http://crm/_root/homepage.aspx?etc=4300
Reports - http://crm/CRMReports/home_reports.aspx
Activities - http://crm/workplace/home_activities.aspx
Calendar - http://crm/workplace/home_calendar.aspx
Articles - http://crm/workplace/home_answers.aspx
Queues - http://crm/workplace/home_workplace.aspx
Competitors - http://crm/_root/homepage.aspx?etc=123
Products - http://crm/_root/homepage.aspx?etc=1024
Sales Literature - http://crm/_root/homepage.aspx?etc=1038
Quotes - http://crm/_root/homepage.aspx?etc=1084
Orders - http://crm/_root/homepage.aspx?etc=1088
Invoices - http://crm/_root/homepage.aspx?etc=1090
Quick Campaigns - http://crm/MA/home_minicamps.aspx
Campaigns - http://crm/MA/home_camps.aspx
Cases - http://crm/CS/home_cases.aspx
Contracts - http://crm/_root/homepage.aspx?etc=1010
Services - http://crm/_root/homepage.aspx?etc=4001
Replace crm for crmdev.mydomain.com or something like that.
Edit:
This links apparently work for the 4.0 version of crm, for example:
Opportunities - http://crm.domain.com/Organization/_root/homepage.aspx?etc=3
Tuesday, October 30, 2007
Object reference not set to an instance of an object
When coding callouts:
string qualifiedStatus = opportunity.new_qualifiedstatus.Value.ToString();
new_qualifiedstatus is a picklist. If we haven't selected any value from that picklist we will get a null reference exception (not an empty or null string). So the right way to assign this would be:
if(opportunity.new_qualifiedstatus != null)
{
string qualifiedStatus = opportunity.new_qualifiedstatus.Value.ToString();
}
string qualifiedStatus = opportunity.new_qualifiedstatus.Value.ToString();
new_qualifiedstatus is a picklist. If we haven't selected any value from that picklist we will get a null reference exception (not an empty or null string). So the right way to assign this would be:
if(opportunity.new_qualifiedstatus != null)
{
string qualifiedStatus = opportunity.new_qualifiedstatus.Value.ToString();
}
Tuesday, October 23, 2007
Subscribe to:
Posts (Atom)