Acumatica: How to Update the FS Manufacturer and Model on Stock Items - acumatica

I'm trying to update the Manufacturer and Manufacturer Model on the "Service Management" tab of the Stock Item (IN202500).
I'm about 99% sure that they must be in a Graph Extension, but the Schema Browser only indicates that they are in a DLL, not the name of the extension. More generically, if a field is in an Extension, is there a way to find out which one? Or enumerate the extensions that exist in a Graph Cache?
InventoryItem row = Base.ItemSettings.Current;
// This doesn't work. InventoryItemFSxEquipmentModel isn't the name of the extension and IDK how I figure out what it is.
InventoryItemFSxEquipmentModel rowExt2 = PXCache<InventoryItem>.GetExtension<InventoryItemFSxEquipmentModel>(row);
// This also doesn't work, as it isn't in the base model.
throw new PXException(row.ManufacturerID.ToString());

To find out which graph extension a field is in, you can use the "Customization Project Editor" in Acumatica.
Open the "Customization Project Editor" (SM204505) screen in Acumatica.
In the "Object Name" field, type "InventoryItem" and click "Search".
Click the "+" icon next to "InventoryItem" to expand the list of customization items for the InventoryItem DAC.
Look for the field you're interested in (in this case, Manufacturer and Manufacturer Model), and you should see the name of the graph extension that contains that field listed next to it.
Once you know the name of the graph extension, you can use that to get the extension instance for the current record, like this:
InventoryItem row = Base.ItemSettings.Current;
InventoryItemExt rowExt = row.GetExtension();
Replace "InventoryItemExt" with the name of the actual graph extension that contains the fields you're interested in.
Then you can access the Manufacturer and Manufacturer Model fields like this:
string manufacturer = rowExt.UsrManufacturer;
string model = rowExt.UsrManufacturerModel;
Replace "UsrManufacturer" and "UsrManufacturerModel" with the names of the actual fields in the graph extension that you're working with.

Related

Acumata Web Service Endpoint add Vendor Locations

I'm trying to use a Contract API application to edit and maintain vendor Locations.
I'm slightly confused on how I add a detail to the web service endpoint. I can easily add fields, but it seems when I try to add a new element it's not actually loading anything.
Here is what I did:
Added Object with name "Locations" and type "Detail"
Under that, added a top level call "Location" with screen id "Customer Locations"
Added fields to that
I used this VB code:
VendorFind = soapClient.Get(New Vendor With {.ReturnBehavior = ReturnBehavior.All,
.VendorID = New StringSearch With {.Value = "V01026"},
.Locations = New Locations() {New Locations With {.ReturnBehavior = ReturnBehavior.All}}})
It compiles and works but doesn't load the locations.
Anyone have any thoughts on how I achieve this?
For your custom endpoint you might want to use the 'Populate' option on the web service endpoint screen and select the required fields . Use the Vendor Location summary to get header information like vendor, location name etc and then select the details by selecting the correct mapped object for instance "General Info--> Location Contact " . This works fine and populates location details correctly for a selected vendor using postman tool . I am not much familiar with Vb but I suppose the issue might be in the way the endpoint entities are extended.

Same custom field on both Location screen and Customer screen

I'm trying to add the same custom field in Acumatica 2017 R2 to both the Location screen (AR303020) and the Customers (AR303000) screen. There are other native fields found on the "Customers > Delivery Settings" tab that exhibit the behavior I'm trying to match. (Example: Tax Registration ID, Tax Zone, etc.) These fields can be viewed/edited from either the Customers screen or the Locations screen.
Using the Customization Project browser I'm able to add the field to the Location screen easily enough.
Next, I would like to add a new custom field into the "Customers > Delivery Settings tab > Default Location Settings group" that uses the same DAC as the custom field that was added to the Locations screen.
But I'm not sure how to properly define the same field for the Customers screen. By default, the Customization Browser adds a custom field to the CR.Address DAC. I've tried creating a new CR.Address field with this definition:
There are no errors during publishing, but Acumatica will not load the Customer or Locations screens. The error is "Invalid column name 'UsrCertificateDate". I intentionally did not add a column for UsrCertificateDate to the CRAddress database table because the column was previously added to the Location table. I'd prefer not to maintain two database fields if only one is needed.
How can I make a custom field on these two screens work together? Editing the Default Location from the Customers screen should change the value when viewing the Location from the Locations screen and vice-versa.
First of all, you should consider declarations of DAC Location and Address:
Location:
[Serializable]
public class Location : IBqlTable, IPaymentTypeDetailMaster, ILocation
{
.
.
Address:
[Serializable]
public class Address : IBqlTable, IAddressBase, IValidatedAddress, IPXSelectable
{
.
.
.
as you can see from declarations, both of them implement IBqlTable, so it means that Location and Address live as separated entities in Acumatica.
Following sql in your db will show to you that both tables have their own life:
select top 10 * from Location
select top 10 * from Address
you will see different outputs. It also means that you can't use one DAC extension for the same table, but you'll need to extensions. And also you'll need to add two columns for Location and Address table.
One more point for you to be careful, there is a difference between DAC which is CR.Address and CRAddress.
Take a look at CRAddress declaration:
[Serializable]
public class CRAddress : IBqlTable, IAddress, IAddressBase, IValidatedAddress
{
.
.
.
as you can see from declaration, entity CRAddress is third table.
If to assume all of this you'll either to add the same column twice to Location and Address DAC extensions, or as another option you can create table CertificationDates which will have Certifications dates as one of the columns, and in both extensions to have ID for CertificationDates as foreign key.

Acumatica changing cache name from extension

We currently have a project where we have extended a number of screens. We need to change the cache name of certain Acumatica DACs through their extension. For some of the cases we were able to change the names using translation dictionaries, for example in the case of Vendor. In other cases, for example APInvoice and Lead/Contact in the Vendor screen, we were unable to do so.
Is there a way to change the cache/view names of objects that cannot be changed through translation dictionaries, so that in the Auditing screen and when error messages pop-up on screen during save, the correct object name is displayed?

MS PowerApps Deep Linking

I'm passing a parameter to a PowerApp through the calling URL called ID, i.e.
https://web.powerapps.com/apps/powerappid?ID=32
When the app launches I want it to jump from BrowseScreen1 which lists all the Business Cases and go straight to the Business Case with the matching ID (a field from a SharePoint list).
I'm brand new to PowerApps but pretty sure what I need to do is called Deep Linking and I found this tutorial https://powerapps.microsoft.com/en-us/blog/powerapps-deep-linking/ and having read the comments to the article I'm trying to apply it to the OnStart property of BrowseScreen1. I don't really understand how the navigation link in the tutorial is constructed so I'm sure I'm using the wrong Navigation parameters as it always launches the first record in the list ignoring anything to do with the ID. I'm using:
If(Not(IsBlank(Param("ID"))),Navigate(DetailScreen1,
None,{ID:LookUp('Full Business Case For Review'.ID, ID =
Value(Param("ID")))}))
'Full Business Case For Review' is the name of the Sharepoint list and ID is a unique field that gets assigned to each list item.
The tutorial doesn't mention having to change anything on the detail screen but I've also wondered if I need to perhaps change the item properties there as they are currently:
BrowseGallery1.Selected
I'm feeling out of my depth and would really appreciate some help on this!
Thanks,
John
Yes, you need to change the Item property in the detail screen. This is because there is currently no way to select an item in a gallery programmatically in PowerApps.
I normally get around this by using a global variable to store the current item, so you can set BrowseSreen1.OnStart to this
If(Not(IsBlank(Param("ID"))),
Set(CurrentItem, LookUp('Full Business Case For Review'.ID, ID = Value(Param("ID"))));
Navigate(DetailScreen1, None)
)
This will store the item with ID equal to your parameter as a record type variable.
You also need to change the OnSelect property of your BrowseGallery1's template or whichever control is used to navigate to the detail screen. It will need to be something like this
Set(CurrentItem, ThisItem); Navigate(DetailScreen1, None)
Finally set the Item property in the detail screen simply to this
CurrentItem

Defaulting parent entity of custom activity

This should be a simple thing, but as I am quickly finding out with CRM 2011, simple things almost never are...
Anyway, I have a custom activity type, a "Trip". A Trip represents a single visit by a service technician to a client's site. Trips are always created in connection with a Case (Incident) and never with any other entity type, so the entity exists as a custom activity that does not "Display In Activity Menus". That allows me to drop a subgrid of Trips into the primary Case view, making it the only place these things can be created.
The problem is that when I try to create a new Trip from the Case form (by clicking the subgrid and choosing "Add New Trip" from the ribbon), the "Regarding" field isn't populated with the Case that I was on when I clicked "Add". Any of the "built-in" activity types will default their corresponding field with no problem, so it would seem to me that I can do the same here. The field's supposed to be read-only once this defaulting works, but just so I can set up the reference when creating new Trips, I've made it editable, and of course when you pop up the lookup, you can assign this Trip to anything (which is why I want the field read-only in the first place).
I need the form to default the parent Case when the Trip form loads. It has to be there when it's first created, because if it isn't there on the first save, then some plugin code that sets other default values (namely data relating to other Trips that may or may not exist for the same Case) won't work properly.
I read about relationship field mapping, where you can default the values of various fields based on fields of the parent entity, but the relationship between the Incident and my Trip is not listed as mappable from either side and I can't figure out how to make it mappable. I also know it's possible to set default values using JavaScript, but if there's a less "custom" way to set this particular behavior up I would love to know how.
As an epitaph based on Mike's comment, it does indeed seem that Microsoft doesn't want this done. But, it's still possible to do it. The basic steps are:
Download the Ribbon Workbench solution and import it into CRM.
Create a new solution containing the entity or entities you want to be able to customize.
Create a JavaScript file containing functions that will open the form you want and pass the information you need as a parameter. There are two ways to specify the parameters; you can define custom parameters on the form, or you can use Microsoft's undocumented parameters for the Regarding field:
function OpenNewTripFromCase()
{
var entityId = Xrm.Page.data.entity.getId();
var entityTypeCode= Xrm.Page.context.getQueryStringParameters().etc;
var entityDisplayName = Xrm.Page.getAttribute("title").getValue();
var params = {};
params["pId"] = entityId;
params["pType"] = entityTypeCode;
params["pName"] = entityDisplayName;
Xrm.Utility.openEntityForm("cst_trip", null, params);
}
Import this JavaScript file as a Web Resource, and add it to the Solution so it will be available to Ribbon Workbench.
Open up Ribbon Workbench and open the solution you created with your entity and resources. Click the Solution Elements tab, and find the "Commands" item. Right-click and select "Add New". Now expand the list, find and click on your new command. In the Properties pane, change the name of the command to be more descriptive (it's recommended you only change the third "Command#" term), then click the magnifying glass button to the right of the Actions field.
In the window that pops up, click "Add", then choose "JavaScript Function Action". A new item will be added to the action list. Click it, then in the properties pane to the right, find the library containing your function, then type in the function name. I didn't get any sort of IntelliSense here, so be careful typing in the function name. Add parameters if you need to (you shouldn't need to with the code above), then click OK
Now click the custom activity entity in the Entities list of Ribbon Workbench, then in the dropdown to the upper right of the ribbon layout, select the SubGrid ribbon. Create a button in this Ribbon, give it the icon and text you want, and in the Properties pane, set the Command to the command you just created.
Publish the customized Solution, and you should, if you did everything correctly, have a new button that will do the same thing as the "Add New" button when you've selected a sub-grid, but will additionally populate the Regarding field.

Resources