+ Start a Discussion
Uves RavatUves Ravat 

field expression not allowed for generic sobject

Hi,

 

i am having an error with this. it says field expression not allowed for generic sobject

 

the code is 

 

			for (SObject subDynamInvoice : dynamInvoice.c2g__PurchaseInvoiceLineItems__r )
			{
				mapOfInvoiceNameToInvoice2.put(invName, subDynamInvoice );
			}

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
HariDineshHariDinesh

Hi,

 

Please look at the following discussion Boards like which might be helpful.

 

http://boards.developerforce.com/t5/Apex-Code-Development/Field-expression-not-allowed-for-generic-SObject/td-p/152613

All Answers

HariDineshHariDinesh

Hi,

 

Please look at the following discussion Boards like which might be helpful.

 

http://boards.developerforce.com/t5/Apex-Code-Development/Field-expression-not-allowed-for-generic-SObject/td-p/152613

This was selected as the best answer
Uves RavatUves Ravat

i tried the following but still gave me an error

 

			for (SObject subDynamInvoice : (SObject)dynamInvoice.get('c2g__PurchaseInvoiceLineItems__r'))
			{
				mapOfInvoiceNameToInvoice2.put(invName, subDynamInvoice );
			}
		}

 it said now the loop must iterate over a collection of SOBJect

thanks

Chidanand M 5Chidanand M 5
Hi Uves Ravat,

Did you find solution for this. Even i am stuck with the same issue.
Could you please post the solution here if you have resolved it.
I need it very urgently.

TIA.