Trouble retruning a string in display method

As you can tell…I am a newbie when it comes to AX. With that said I am having trouble with the below method…I created a display method returnin a real value type…but when I try to return a string…I am getting an error. Can someone point out what is wrong with the below code; do I need to declare a string type??

display InventTrans GetItemID()
{
InventTrans inventTrans;
;

select * from inventTrans where inventTrans.InventTransId == CDFailureAnalysis_1.InventTransId;

return inventTrans.ItemId;

}

This has been solved…Thanks!!!

Hello

I have the same problem. How did you fix the error?

Sandy,

the returning type should be ItemId, not InventTrans. it should be like: display ItemId GetItemID() {…}

display InventTrans GetItemID()
{
InventTrans inventTrans;
;

select * from inventTrans where inventTrans.InventTransId == CDFailureAnalysis_1.InventTransId;

return inventTrans.ItemId;

}

Just to clarify, the above should be - “display ItemId GetItemId()”

Is this correct?

yes Harish. sorry, i should have be clear on that. Thanks.