Skip to main content

Hello,

I want to know how to create POOrder and PORecip dynamicly and in background from SOShipment?

Thanks,

Hello @mohamed1walha,

Could you share more details about the actual business scenario you are trying to address? Have you completed the standard Acumatica developer training already?

Thanks.


Hello @Gabriel Michaud 

Thank you for your answer,

In fact the scenario is as follows: When I confirm a shipment for a product that is out of stock, I want to dynamically create a supplier order with a specific supplier with the same lines of the shipment, after that I want to create a receipt from the control supplier.

 

 


Bonjour @mohamed1walha,

You could certainly achieve this through customization, however it sounds a bit overkill to me; Acumatica has a built in replenishment workflow that can be used to trigger a purchase order or inventory transfer when it gets below some threshold. These processes can be scheduled and run on a regular basis. You can read more about Automated Replenishment in the Acumatica Help.

Please note that Acumatica will not create a shipment automatically for an order if you don’t have enough inventory to fulfill this order; if your goal is to always keep 0 inventory on hand and always do a PO for these orders than I think what you need to investigate is drop shipment (Livraisons Directes on CEGID XRP Flex) 

cc @SadokHanini 


Bonjour @mohamed1walha,

You could certainly achieve this through customization, however it sounds a bit overkill to me; Acumatica has a built in replenishment workflow that can be used to trigger a purchase order or inventory transfer when it gets below some threshold. These processes can be scheduled and run on a regular basis. You can read more about Automated Replenishment in the Acumatica Help.

Please note that Acumatica will not create a shipment automatically for an order if you don’t have enough inventory to fulfill this order; if your goal is to always keep 0 inventory on hand and always do a PO for these orders than I think what you need to investigate is drop shipment (Livraisons Directes on CEGID XRP Flex) 

cc @SadokHanini 

Thanks Gabriel :) 
But we need to create a supplier order for another company not the one we are connected 


@SadokHanini well, that changes everything -- is it another company contained in a different tenant of the same instance, or different instance?


@SadokHanini well, that changes everything -- is it another company contained in a different tenant of the same instance, or different instance?

the Same instance


I can think of two approaches, one that will work, the other i’m not so sure and needs to be tried out:

  • You can use Acumatica web services API to communicate with the other tenant
  • You can try to impersonate the user of another tenant by using PXLoginScope, but i’m not sure if it’s appropriate for this scenario

Example of login scope approach:

using (new PXLoginScope(user + "@" + tenant))
{
YourLogicThatRunInTheScopeOfAnotherTenant()
}

 


I can think of two approaches, one that will work, the other i’m not so sure and needs to be tried out:

  • You can use Acumatica web services API to communicate with the other tenant
  • You can try to impersonate the user of another tenant by using PXLoginScope, but i’m not sure if it’s appropriate for this scenario

Example of login scope approach:

using (new PXLoginScope(user + "@" + tenant))
{
YourLogicThatRunInTheScopeOfAnotherTenant()
}

 

Thanks Gabriel, i will give it a try tomorrow morning 
and for the creation SO how can be done ?


I can think of two approaches, one that will work, the other i’m not so sure and needs to be tried out:

  • You can use Acumatica web services API to communicate with the other tenant
  • You can try to impersonate the user of another tenant by using PXLoginScope, but i’m not sure if it’s appropriate for this scenario

Example of login scope approach:

using (new PXLoginScope(user + "@" + tenant))
{
YourLogicThatRunInTheScopeOfAnotherTenant()
}

 

Thanks Gabriel, i will give it a try tomorrow morning 
and for the creation SO how can be done ?

I’m confused -- you need to create SO or PO? In any case, you’ll need to hook into the Confirm Shipment action, then create a graph instance and fill up the required fields. Have you completed the full Acumatica developer training? This is covered.


I can think of two approaches, one that will work, the other i’m not so sure and needs to be tried out:

  • You can use Acumatica web services API to communicate with the other tenant
  • You can try to impersonate the user of another tenant by using PXLoginScope, but i’m not sure if it’s appropriate for this scenario

Example of login scope approach:

using (new PXLoginScope(user + "@" + tenant))
{
YourLogicThatRunInTheScopeOfAnotherTenant()
}

 

Thanks Gabriel, i will give it a try tomorrow morning 
and for the creation SO how can be done ?

I’m confused -- you need to create SO or PO? In any case, you’ll need to hook into the Confirm Shipment action, then create a graph instance and fill up the required fields. Have you completed the full Acumatica developer training? This is covered.

PO sorry, in progress i have only 1 month on flex so im learning and also i need to achieve some dev (to do urgently)
Lack of experience 

 

The complexity of what you’re trying to achieve is quite high, due to the need to cross tenants. I strongly suggest completing the standard developer training offered by Acumatica to ensure you have the knowledge required to complete this customization. 

 

For a trivial example of PO creation via code, you have this one on StackOverflow: https://stackoverflow.com/questions/49886811/how-to-create-purchase-order-via-code


The complexity of what you’re trying to achieve is quite high, due to the need to cross tenants. I strongly suggest completing the standard developer training offered by Acumatica to ensure you have the knowledge required to complete this customization. 

 

For a trivial example of PO creation via code, you have this one on StackOverflow: https://stackoverflow.com/questions/49886811/how-to-create-purchase-order-via-code

Thanks, i appreciate ur help and time :) 


Thx! It works.


Reply