Merge Few Customizations Into One

 

Hello everybody,

today I want to leave a short notice on how to join few customizations into one. Basically all you need is publish customizations you want to have merged, and then on Customization Projects form ( SM204500 ) click on button View Published and then click on Download package. In that way you'll get Customization.zip which will be merged result of published customizations.

No Comments

 

Add a Comment
 

 

How To Modify Pxintlist Dynamically In Acumatica

 

Hello everybody,

today I want to leave a short code sample on how to modify PXIntList or dropdown list in Acumatica. Below goes code sample of it:

protected virtual void _(Events.RowSelected<CROpportunity> e)
{
    if (e.Row == null)
        return;
    var opportunityExtension = e.Row.GetExtension<CROpportunityExt>();
 
    if (opportunityExtension.UsrProduct == 0)
    {
        var listInts = new List<int>();
        var listStrings = new List<String>();
 
        listInts.Add(0);
        listInts.Add(1);
        listInts.Add(2);
 
        listStrings.Add("String 1");
        listStrings.Add("String 2");
        listStrings.Add("String 3");
 
        PXIntListAttribute.SetList<CROpportunityExt.usrProposition>(e.Cache, e.Row, listInts.ToArray(), listStrings.ToArray());
    }
 
    if (opportunityExtension.UsrProduct == 1)
    {
        var listInts = new List<int>();
        var listStrings = new List<String>();
 
        listInts.Add(0);
        listInts.Add(3);
        listInts.Add(5);
 
        listStrings.Add("String 2");
        listStrings.Add("String 3");
        listStrings.Add("String 4");
 
        PXIntListAttribute.SetList<CROpportunityExt.usrProposition>(e.Cache, e.Row, listInts.ToArray(), listStrings.ToArray());
    }
}

This code sample has two most important parts: 

  1. RowSelected ( declared over new syntax )
  2. PXIntListAttribute.SetList<CROpportunityExt.usrProposition> call

With usage of those two principles you can easily get modifiable collection accoding to necessary conditions in your code.

No Comments

 

Add a Comment
 

 

Warning You Are Not In Maintenance Mode

 

Hello everybody,

today I want to make a post about new security feature of acumatica, which guard you from creating corrupted data. Suppose you are System Administrator and want to make snapshot for being able use it to set settings to new company, which you just created. However, some user might use it too, and this may cause the creation of bad records. For this reason, in latest versions of Acumatica (from 2017 R2), when you try to create snapshot, you'll recieve an warning message: 

Warning message informs, that you should switching the maintenance mode, so do it, as shown below, by click "SCHEDULE LOCKOUT":

 

Now you able, without any risk, create snapshot:

On the end, don't forget to remove the lockout by click "STOP LOCKOUT":

Using this technique, your Acumatica application will be safe and stable.

No Comments

Add a Comment
 

 

Creating New Company Set Settings

 

Hello everybody,
today I want share with you, how you can create new Company and set it settings.

For creating new company, we should go to "Tenants" screen:

Notice, that in old vercions of acumatica instead the "Tenants" was the "Companies":

Let create new company, and give it name "Exotic Places":

When process of creation is finished, we'll automatically be logged out:

 

To fix this, let's copy the settings from existing company to our. First of all let us sign out from "Exotic Places" and sign in to "Company". Then open "Tenants", chose the "Company" and click to "Create Snapshot" button:

We get a warning message, but it possible easily deal with it, only go to this link, to short post of my blog and you'll done it. After it let try again:

Press "Save" on the toolbar of the form, then import snapshot into our new company:

Now let's restore snapshot to "Exotic Places":

After it let explore, what have we done:

Summary: if you'll create new company, then you will need to set the settings for it. To do this, you can copy them from an existing company (as shown on the top):
1. Create the snapshot.
2. Export it.
3. Upload snapshot in new company.
4. Restore snapshot for it.

No Comments

Add a Comment
 

 

Fbql Brackets

 

Hello everybody,

today I want to speak about one very interesting feature of FBQL, which I don't know if exists in BQL. Function Brackets!

Take a look on following code sample:

var bracketsDemo = SelectFrom<SOOrder>.InnerJoin<SOLine>.On<SOLine.orderNbr.IsEqual<SOOrder.orderNbr>>.InnerJoin<SOShipLine>
	.On<SOShipLine.origOrderNbr.IsEqual<SOOrder.orderNbr>>.Where<
		Brackets<SOShipLine.confirmed.IsNotNull.
			And<SOShipLine.baseOrigOrderQty.IsNotNull>.
			And<SOShipLine.completeQtyMin.IsNotNull>.
			And<SOShipLine.confirmed.IsEqual<True>.
				Or<SOShipLine.confirmed.IsNull>>.
			And<SOShipLine.baseOriginalShippedQty.IsGreater<SOShipLine.unassignedQty>.
				Or<SOShipLine.baseOrigOrderQty.IsLess<SOShipLine.baseOriginalShippedQty>>>>.
		Or<SOShipLine.baseOrigOrderQty.IsNotNull>>.AggregateTo<GroupBy<SOOrder.orderNbr>,
		Min<SOOrder.curyDiscTot>>.OrderBy<SOOrder.curyFreightAmt.AscSOOrder.curyDocDisc.Desc>.View.Select(Base);

as you can see from the code, now in FBQL if you need to have Or operator, then as anohter option you may use Brackets.

No Comments

 

Add a Comment
 

 

How To Pass Data Into Processing Method With Help Of Lambda Expression

How to pass data into processing method with help of lambda expression

Hello everybody,

today I want to leave a short note on how to pass some additional parameters into Processing method of processing page with help of lambda expression. Syntax is pretty simple:

public class SSShipmentDateResetter : PXGraph<SSShipmentDateResetter>
{
	public PXFilter<ShipmentFilter> ShipmentFilter;
 
	public PXFilteredProcessing<SOShipment, ShipmentFilter> ShipmentsForProcessing;
 
	public SSShipmentDateResetter()
	{
		var shipmentFilter = ShipmentFilter.Current;
		ShipmentsForProcessing.SetProcessDelegate(shipments =>
		{
			ResetDate(shipmentFilter, shipments);
		});
	}
 
	public static void ResetDate(ShipmentFilter filter,  List<SOShipment> shipments)
	{
		
	}
}

for me such approach is a bit easier to use as it involes a bit less amout of typing.

If you want to have even simpler syntax, then following sample also may work for you:

public SSShipmentDateResetter()
{
	var filter = ShipmentFilter.Current;
	ShipmentsForProcessing.SetProcessDelegate(shipments => ResetDate(filter, shipments));
}

For simplicity sake, I've showed only constructor.

No Comments

 

Add a Comment
 

 

How To Enable Some Control In Acumatica

How to enable some control in Acumatica

Hello everybody,

today I want to leave a short note for the following situation:

Imagine that you need to enable some control in Acumatica ( for example Mark for PO ) on page Sales orders ( SO301000 ).

As usually for enabling control there are two ways:

  1. RowSelected
  2. Automation steps.

Recently I found third option, when neither 1 nor 2 did work. After spending some time I found third option: Cache has property AllowUpdate. After I've set it to true, I was able to modify lines in Document details. 

In your code it may look like this:

protected void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
{
        if (del != null)
              del(cache, e);
        SOLine row = (SOLine)e.Row;
        if (row == nullreturn;
        Base.Transactions.Cache.AllowUpdate = true;
        PXUIFieldAttribute.SetEnabled<SOLine.pOCreate>(cache, row, true);
        PXUIFieldAttribute.SetEnabled<SOLine.shipDate>(cache, row, true);
}

you still may need Row_Selected event handler, but not forget to add AllowUpdate = true.

No Comments

Add a Comment
 

 

How To Restore Snapshot Of Acumatica

How to restore snapshot of Acumatica

Hello everybody,

today I want to leave a post on how to restore Acumatica snapshots with help of Acumatica Wizard.

Before creating snapshot you may need to switch Acumatica to maintenance mode. Below are the steps for achieveing it:

1. Go to System --> Management --> Apply Updates, click on the button "Schedule Lockout" and specify the reason for lockout
2. Don't forget to remove the lockout after you'll restore Snapshot.

Steps are the following:

1. Create a snapshot of the tenant you wish to back up

2. Export that snapshot (I recoment  xml format).

3. In the folder where the corresponding Acumatica Wizard is installed (usually c:\program files\Acumatica ERP\), find the folder called  \Database\Data, where there are individual folders with snapshot data.

4. Create a new folder for your new snapshot

5. Extract the contents of the .zip exported snapshot into the new folder you created

6. Run the Acumatica Wizard

7. Choose the "Perform Application Maintenance" option

8. Select the site into which you wish to import this data

9. Choose the "Tenant Maintenance" option or "Company Maintenance":

10. Click on the "Advanced Settings" button at the bottom

12. Click on the "Insert Data" option next to the tenant where the data should be imported and select the new folder/snapshot you added in step #4 above:

13. Proceed through the wizard as normal. When the install process is complete you should have a tenant with restored data.

No Comments

Add a Comment
 

 

New Syntax Of Setvisibility Method In Acumatica

 

Hello everybody,

today I want to write a few words about changes of PXUIFieldAttribute.SetVisibility method. 

In the past, if you wanted to turn on some column, you could write in RowSelected event something like this:

          PXUIFieldAttribute.SetVisibility<APRegister.finPeriodID>(Documents.Cache, nulltrue);

If you want to turn it off, then this:

PXUIFieldAttribute.SetVisibility<APRegister.finPeriodID>(Documents.Cache, nullfalse);

But for quite a long time ( even in 2017 version ), Acumatica team introduced PXUIVisibility enum. In code it looks like this:

[Flags]
public enum PXUIVisibility
{
  Undefined = 0,
  Invisible = 1,
  Visible = 3,
  SelectorVisible = 7,
  Dynamic = 9,
  Service = 19,
  HiddenByAccessRights = 33,
}

For now I can comment on Visible and InVisible which correspond to false and true in the past implemtations. And in future posts I'll describe other selectors. 

No Comments

Add a Comment
 

 

How To Change All Emails In Acumatica

 

Hello everybody,

today I want to leave a post on how to change all emails, which are contained in Acumatica. For this purpose you may use script below:

UPDATE contact SET    email = email + '.ts'

UPDATE socontact SET    email = email + '.ts'

UPDATE apcontact SET    email = email + '.ts'

UPDATE pocontact SET    email = email + '.ts'

UPDATE crcontact SET    email = email + '.ts'

UPDATE arcontact SET    email = email + '.ts'

UPDATE fscontact SET    email = email + '.ts'

UPDATE crcasecontacts SET    email = email + '.ts'

UPDATE crcontact SET    email = email + '.ts'

UPDATE pmcontact SET    email = email + '.ts' 

If you wonder, what can be the usage of such SQL, consider following scenario. You've restoed from back up some database. And you need to see if Automation schedules work fine. How can you do it without deletion of all of them and spamming of all customers of your customer? The only way would be updating emails in your database.

If you know any other table that contains e-mails which I've missed, let me know, I'll update this SQL script accordingly.

No Comments

 

Add a Comment