Answered by:
Pass Booleabn & date to CRM

Question
-
I am writing a SQLCLR database project, to update CRM from an legacy SQL server. I have had some great help, so far and thank you to everybody.
I am expanding my original procedures but am stuck on trying to pass a Boolean and a date
public static void CreateNewCustomer(SqlString LicenceNo, SqlString CompanyName, SqlInt32 Software, SqlInt32 SoftwareStatus, SqlBoolean HasDD, SqlDateTime DDposted, SqlString DDsortcode, SqlString DDaccountnumber, SqlString DDaccountname, SqlBoolean authorisesubmissions, SqlBoolean payrollclient, SqlBoolean auddisenabled) CONNECTION INFO REMOVED // Add Licence No account.name = LicenceNo.Value; // Add Company Name account.new_companyname = CompanyName.Value; // Add Software account.new_software = new Picklist(); account.new_software.Value = Software.Value; // Add System Status account.new_state = new Picklist(); account.new_state.Value = SoftwareStatus.Value ; // Check Has DirectDebit Mandate if (HasDD = true) { account.new_ddactive = true; account.new_ddsortcode = DDsortcode.Value; account.new_ddaccountnumber = DDaccountnumber.Value; account.new_ddaccountname = DDaccountname.Value; account.new_ddposted = DDposted.Value; } else { } Error 1 Cannot implicitly convert type 'bool' to 'SqltoCRMTest.crmSdk.CrmBoolean' Error 2 Cannot implicitly convert type 'System.DateTime' to 'SqltoCRMTest.crmSdk.CrmDateTime'
Dont ask me .. i dont know
Wednesday, July 17, 2013 4:39 PM
Answers
-
account account = new account(); // Add Licence No account.name = LicenceNo.Value; // Add Company Name account.new_companyname = CompanyName.Value; // Add Software account.new_software = new Picklist(); account.new_software.Value = Software.Value; // Add System Status account.new_state = new Picklist(); account.new_state.Value = SystemStatus.Value; // add dd = true account.new_dd_active.Value = true; crmService.Create(account);
This is throwing a .Net framework error.
new_dd_active is a twoOption field, and this is what is causing the problem
We have a lot of TwoOption fields in our custom entities. I need to find a solution to this problem
- Edited by Pete Newman Friday, July 19, 2013 12:18 PM update
- Marked as answer by Pete Newman Wednesday, July 31, 2013 3:29 PM
Thursday, July 18, 2013 6:43 PM
All replies
-
The account.new_ddactive is a Yes / No option in CRM
Dont ask me .. i dont know
Thursday, July 18, 2013 10:45 AM -
account account = new account(); // Add Licence No account.name = LicenceNo.Value; // Add Company Name account.new_companyname = CompanyName.Value; // Add Software account.new_software = new Picklist(); account.new_software.Value = Software.Value; // Add System Status account.new_state = new Picklist(); account.new_state.Value = SystemStatus.Value; // add dd = true account.new_dd_active.Value = true; crmService.Create(account);
This is throwing a .Net framework error.
new_dd_active is a twoOption field, and this is what is causing the problem
We have a lot of TwoOption fields in our custom entities. I need to find a solution to this problem
- Edited by Pete Newman Friday, July 19, 2013 12:18 PM update
- Marked as answer by Pete Newman Wednesday, July 31, 2013 3:29 PM
Thursday, July 18, 2013 6:43 PM