Skip to main content

I am working on T190 and in step 3.2 where we need to add this code

 

RSSVLabor labor = SelectFrom<RSSVLabor>.
                              Where<RSSVLabor.deviceID.IsEqual<@P.AsInt>.
                              And<RSSVLabor.serviceID.IsEqual<@P.AsInt>>.
                              And<RSSVLabor.inventoryID.IsEqual<@P.AsInt>>>.View.Select(this, line.DeviceID, line.ServiceID, line.InventoryID);

 

issue here is I am getting error that


'RSSVWorkOrderLabor' does not contain a definition for 'DeviceID' and no accessible extension method 'DeviceID' accepting a first argument of type 'RSSVWorkOrderLabor' could be found (are you missing a using directive or an assembly reference?)    PhoneRepairShop_Code    D:\Acumatica\AcumaticaERP2\App_Data\Projects\PhoneRepairShop_Code\PhoneRepairShop_Code\RSSVWorkOrderEntry.cs

 

can anyone help me with this ?
 

Hi @param2022  Can you please share the full Graph code here. 

If you are doing all these code at customization project, please share the customization project here.

 


Hi @param2022  Can you please share the full Graph code here. 

If you are doing all these code at customization project, please share the customization project here.

 

This is the file and OrderLabor does not contain the two fields of serviceId and DeviceID i dont know how i can add them. Thanks for replying.

 


I think you wrote out the code incorrectly.  When I check the documentation and the code files that are provided I see the following:

RSSVLabor labor = SelectFrom<RSSVLabor>.
Where<RSSVLabor.serviceID.IsEqual<@P.AsInt>.
And<RSSVLabor.deviceID.IsEqual<@P.AsInt>>.
And<RSSVLabor.inventoryID.IsEqual<@P.AsInt>>>
.View.Select(this, workOrder.ServiceID, workOrder.DeviceID, e.Row.InventoryID);

I think you have mistyped the variable names passed as the Select parameters


I think you wrote out the code incorrectly.  When I check the documentation and the code files that are provided I see the following:

RSSVLabor labor = SelectFrom<RSSVLabor>.
Where<RSSVLabor.serviceID.IsEqual<@P.AsInt>.
And<RSSVLabor.deviceID.IsEqual<@P.AsInt>>.
And<RSSVLabor.inventoryID.IsEqual<@P.AsInt>>>
.View.Select(this, workOrder.ServiceID, workOrder.DeviceID, e.Row.InventoryID);

I think you have mistyped the variable names passed as the Select parameters

can you please provide which documentation you are following. I have this training PDF and workOrder variable is not initialized any where in this code snippet.


Important note: The document you attached is for 2019 - you should get more up to date training materials. I didn’t do T190 but, instead, did the T200 series (T200..T250).

However, in my T220 documentation it reads as you have typed it.  When I look at the supplied code files it shows something different. So I think that the documentation might be incorrect, even in the updated version. My full code listing for that method looks like this:

//Validate that Quantity is greater than or equal to 0 and
//correct the value to the default if the value is less than the default.
protected virtual void _(Events.FieldVerifying<RSSVWorkOrderLabor,
RSSVWorkOrderLabor.quantity> e)
{
if (e.Row == null || e.NewValue == null) return;

if ((decimal)e.NewValue < 0)
{
//Throwing an exception to cancel the assignment of the new value to the field
throw new PXSetPropertyException(Messages.QuantityCannotBeNegative);
}

var workOrder = WorkOrders.Current;
if (workOrder != null)
{
//Retrieving the default labor item related to the work order labor
RSSVLabor labor = SelectFrom<RSSVLabor>.
Where<RSSVLabor.serviceID.IsEqual<@P.AsInt>.
And<RSSVLabor.deviceID.IsEqual<@P.AsInt>>.
And<RSSVLabor.inventoryID.IsEqual<@P.AsInt>>>
.View.Select(this, workOrder.ServiceID, workOrder.DeviceID, e.Row.InventoryID);
if (labor != null && (decimal)e.NewValue < labor.Quantity)
{
//Correcting the LineQty value
e.NewValue = labor.Quantity;
//Raising the ExceptionHandling event for the Quantity field
//to attach the exception object to the field
e.Cache.RaiseExceptionHandling<RSSVWorkOrderLabor.quantity>(e.Row, e.NewValue,
new PXSetPropertyException(Messages.QuantityToSmall, PXErrorLevel.Warning));
}
}
}

Have a look for a HelpAndTraining folder within your Acumatica installation - in there you will have the source code for the whole project.


Reply