thuphinguyen / php-dynamics-crm-2011

Automatically exported from code.google.com/p/php-dynamics-crm-2011
0 stars 0 forks source link

fill in an option set #50

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
hello i Want to fill in an option set, but i don't understand how to do.

for example i have 

    <select class="element select medium" id="Country" name="Country"> 
            <option value="" selected="selected"></option>
<option value="0" >Afghanistan</option>
<option value="1" >Albania</option>
<option value="2" >Algeria</option>

the value is the same value as my option set in the crm but it said me that i 
have to sayt it's a country type option set.

Where should i Set the otpion set Type ?

Original issue reported on code.google.com by damiench...@gmail.com on 27 May 2013 at 9:30

GoogleCodeExporter commented 9 years ago
If I've understood your request correctly, you want to set a property on an 
Entity (e.g. an Account) which is an OptionSet in the CRM - for example, the 
Country field on the Account.

To do this, you should be able to set using the numeric value, the description 
or the DynamicsCRM2011_OptionSetValue class.

For example:
[code]
$crmConnector = new DynamicsCRM2011_Connector($discoveryServiceURI, 
$organizationUniqueName, $loginUsername, $loginPassword);
$account = new DynamicsCRM2011_Account($crmConnector);
$account->Country = new DynamicsCRM2011_OptionSetValue(0, 'Afghanistan');
$account->Country = 0;
$account->Country = 'Afghanistan';
[/code]

You can also use the getOptionSetValues() function on the original entity to 
determine valid values, for example:
[code]
$crmConnector = new DynamicsCRM2011_Connector($discoveryServiceURI, 
$organizationUniqueName, $loginUsername, $loginPassword);
$account = new DynamicsCRM2011_Account($crmConnector);
$valid_countries = $account->getOptionSetValues('Country');
$account->Country = new DynamicsCRM2011_OptionSetValue(0, 'Afghanistan');
[/code]

If you're getting an error doing this, please post an suitable code snippet and 
the error message you are receiving.

Original comment by N.M.Pr...@gmail.com on 30 May 2013 at 9:51

GoogleCodeExporter commented 9 years ago
thank i found the opetionset class after asking my question

Original comment by damiench...@gmail.com on 30 May 2013 at 12:26