In order to achieve your objective you can check the size the of child records, if there is lookup relationship between Order Line & Inventory Allocations.
Refer to the following code for clarity:-
list<OrderLine__c> orderln = [SELECT o.Id, o.nAME, (select id from InventoryAllocation__r) FROM OrderLine__c o limit 1]; system.debug( ' Child Records -->' + orderln[0].InventoryAllocation__r.size());
if(orderln[0].InventoryAllocation__r.size()==0)
{
orderln[0].id=OrderLine__c id which don't have any related records.Now put your desire code here.
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi,
In order to achieve your objective you can check the size the of child records, if there is lookup relationship between Order Line & Inventory Allocations.
Refer to the following code for clarity:-
list<OrderLine__c> orderln = [SELECT o.Id, o.nAME, (select id from InventoryAllocation__r) FROM OrderLine__c o limit 1]; system.debug( ' Child Records -->' + orderln[0].InventoryAllocation__r.size());
if(orderln[0].InventoryAllocation__r.size()==0)
{
orderln[0].id=OrderLine__c id which don't have any related records.Now put your desire code here.
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Please try following :-
[select id, name from OrderLine__c where ID NOT IN (select OrderLine__c from gii__InventoryAllocation__c)]
Please make sure about the soql limits before implementing it in real application.