Hello
when I create a PurchOrder the standard way using the PurchCreateOrder - Form I want to add a field showing the cost center of a selected ProjectId on that Form.
How can I reach that?
*This post is locked for comments
Hi,
On form PurchCreateOrder, created a new string field and fill it up based on the projectId selected on the form.
Perform following steps:
1. Create a string field on the form and set property autoDeclaration to Yes.
2. Create a new method under the datasource PurchTable by name costCenter and use following code.
Path: \Forms\PurchCreateOrder\Data Sources\PurchTable\Methods\costCenter
public DimensionValue costCenter() { ProjTable projTable; DimensionAttributeValueSetItem dimensionAttributeValueSetItem; DimensionAttributeValue dimensionAttributeValue; DimensionAttribute dimensionAttribute; select RecId from projTable where projTable.ProjId == PurchTable.ProjId join RecId, DisplayValue from dimensionAttributeValueSetItem where dimensionAttributeValueSetItem.DimensionAttributeValueSet == projTable.DefaultDimension join RecId from dimensionAttributeValue where dimensionAttributeValue.RecId == dimensionAttributeValueSetItem.DimensionAttributeValue join RecId, Name from dimensionAttribute where dimensionAttribute.RecId == dimensionAttributeValue.DimensionAttribute && dimensionAttribute.Name == "CostCenter"; return dimensionAttributeValueSetItem.DisplayValue; }
3. On the modified method of field ProjId on the datasource, add below code
Path: \Forms\PurchCreateOrder\Data Sources\PurchTable\Fields\ProjId\Methods\modified
public void modified() { super(); CostCenter.text(PurchTable_ds.costCenter()); }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156