• FredoDev
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

Hi  dev,

 

i have a scenario to update an lookup data type field using a string value . can anybody give me the idea / snippet. below i have pasted my code and also the error occur in the result of update function

 

Update = new Account[dtUpdate.Rows.Count];

UpdateItem.Id = Convert.ToString(dtUpdate.Rows[row]["Id"]);

UpdateItem.Tax_Schedule_Name__c = Convert.ToString(dtUpdate.Rows[row]["Tax_Schedule_Name__c"]);   LOOKUP FIELD

UpdateItem.Customer_ID__c = Convert.ToString(dtUpdate.Rows[row]["Customer_ID__c"]);

Update[row] = UpdateItem;

UpdateResult = SFService.update(Update);

 

Error Msg : The Update failed for above record because: Tax Schedule Name: id value of incorrect type: ABC SALES

 

"ABC SALES " IS THE VALUE I AM ASSIGNING TO IT AND ALSO THAT VALUE EXISTS IN THE TAX MASTER TABLE

Hi Devs... 

 

My soql query

soqlQuery = "select id,name, SF__Sa_Ord__r.SF__acc__r.id, SF__Sa_Ord__r.SF__acc__r.name from SF_Account__c";

 

sObject[] records = null;
qResult = SFService.query(soqlQuery);
SF_Account__c SFAccount = new SF_Account__c();
SF__Sa_Ord__c SO = new SF__Sa_Ord__c();


if (qResult.size > 0)
{
MessageBox.Show("Total Number of records Present in Salesforce:"
+ qResult.size);
records = qResult.records;


for (int i = 0; i < records.Length; i++)
{
Acc= (SF_Account__c )records[i];
SA = (SF__Sa_Ord__c)records[i];   ---- Unable 

 

var1 = Acc.Id;

var2 = Acc.Name;

var3 = SA.SF__acc__r.Id;

var4 = SA.SF__acc__r.Name;

 

}

 

Exception : 

Unable to cast object of type

'WindowsFormsApplication1.SFDC.o2bc__Order_Line__c' to type

'WindowsFormsApplication1.SFDC.o2bc__Sales_Order__c'.

 

Can anybody know the solution ?

Hi devs,

 

Can anybody give me a solution. I have the following code

 

sObject[] upserts = new o2bc__Item__c[1];

o2bc__Item__c upsertAccount = new o2bc__Item__c();

 upsertAccount.RecordType.Name ="Product/Parts";  -- Here i got obj reference issue - Can anyone tell how to populate        value for this
upsertAccount.Name = "SFG TEST";
upsertAccount.Rental__c = 150.00;
upsertAccount.Sell_Price__c = 250.00;
upsertAccount.Pricing__c = "Flat";
upsertAccount.Bill_Cycle__c = "Daily";

upserts[0] = upsertAccount;



try
{
int i = 0;
SaveResult[] upsertResults = SFService.create(upserts);
foreach (SaveResult result in upsertResults)
{

if (result.success)
{

MessageBox.Show("Updated Success");


}

Hi devs,

 

Can anybody give me a solution. I have the following code

 

sObject[] upserts = new o2bc__Item__c[1];

o2bc__Item__c upsertAccount = new o2bc__Item__c();

 upsertAccount.RecordType.Name ="Product/Parts";  -- Here i got obj reference issue - Can anyone tell how to populate        value for this
upsertAccount.Name = "SFG TEST";
upsertAccount.Rental__c = 150.00;
upsertAccount.Sell_Price__c = 250.00;
upsertAccount.Pricing__c = "Flat";
upsertAccount.Bill_Cycle__c = "Daily";

upserts[0] = upsertAccount;



try
{
int i = 0;
SaveResult[] upsertResults = SFService.create(upserts);
foreach (SaveResult result in upsertResults)
{

if (result.success)
{

MessageBox.Show("Updated Success");


}