Skip to main content
Solved

Auto-Create Document


Hello,

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

Thanks,

Best answer by Gabriel Michaud

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

View original
Did this topic help you find an answer to your question?

13 replies

Gabriel Michaud
Captain II
Forum|alt.badge.img+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.


  • Author
  • Jr Varsity II
  • 22 replies
  • November 11, 2020

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.

 

 


Gabriel Michaud
Captain II
Forum|alt.badge.img+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 


SadokHanini
Freshman II
  • Freshman II
  • 42 replies
  • November 11, 2020
Gabriel Michaud wrote:

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 


Gabriel Michaud
Captain II
Forum|alt.badge.img+10

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


SadokHanini
Freshman II
  • Freshman II
  • 42 replies
  • November 11, 2020
Gabriel Michaud wrote:

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

the Same instance


Gabriel Michaud
Captain II
Forum|alt.badge.img+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()
}

 


SadokHanini
Freshman II
  • Freshman II
  • 42 replies
  • November 11, 2020
Gabriel Michaud wrote:

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 ?


Gabriel Michaud
Captain II
Forum|alt.badge.img+10
SadokHanini wrote:
Gabriel Michaud wrote:

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.


SadokHanini
Freshman II
  • Freshman II
  • 42 replies
  • November 11, 2020
Gabriel Michaud wrote:
SadokHanini wrote:
Gabriel Michaud wrote:

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 

 

Gabriel Michaud
Captain II
Forum|alt.badge.img+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


SadokHanini
Freshman II
  • Freshman II
  • 42 replies
  • November 11, 2020
Gabriel Michaud wrote:

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


  • Author
  • Jr Varsity II
  • 22 replies
  • November 13, 2020

Thx! It works.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings