Solved

Auto-Create Document

  • 10 November 2020
  • 13 replies
  • 220 views

Userlevel 2

Hello,

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

Thanks,

icon

Best answer by Gabriel Michaud 11 November 2020, 21:59

View original

13 replies

Userlevel 7
Badge +10

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.

Userlevel 2

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.

 

 

Userlevel 7
Badge +10

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 

Userlevel 2

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 

Userlevel 7
Badge +10

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

Userlevel 2

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

the Same instance

Userlevel 7
Badge +10

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()
}

 

Userlevel 2

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 ?

Userlevel 7
Badge +10

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.

Userlevel 2

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 

 
Userlevel 7
Badge +10

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

Userlevel 2

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 :) 

Userlevel 2

Thx! It works.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved