Hello,
I create an opportunityproduct and want to identify the TransactionCurrencyId of the opportunityproduct in the precreate event.
My problem: The currency is set by default from the calling opportunity and has not a value in the input parameters (see below)
protected void PreCreateOpportunityProduct()
{
Logger.WriteVerbose("PreCreateOpportunityProduct5");
IOpportunityProduct opportunityProduct = EntityFactory.Create<IOpportunityProduct>((DynamicEntity)Context.InputParameters["Target"]);
try
{
using (ICrmService CRMService = Context.CreateCrmService(true))
{
if (opportunityProduct == null)
{
Logger.WriteVerbose("No valid opportunityProduct found!");
}
else
{
'returns result, as it was just inserted
Logger.WriteVerbose("Product: " + opportunityProduct.ProductId.Value);
'returns no matching result, as it is delivered by system
Logger.WriteVerbose("Currency: " + opportunityProduct.TransactionCurrencyId.Value);
}
}
}
catch (Exception e)
{
Logger.WriteVerbose("some error! " + e.Message);
}
}
How can I identify opportunityProduct.TransactionCurrencyId.Value in a PreCreateEvent?
Regards, Eckart