Referencing UD fields from an Adapter

Yet another “undocumented feature” of Epicor…

I’m attempting to create a new Case from a Customization. I’m able to create the new Case, with one roadblock - the UD fields.

In the Trace Log, the field HDCase_UD.Character01 is listed, as Character01, with all the other HDCase_UD Fields in the HDCase DataSet. The HDCase_UD Fields are not distinguished from the HDCase Fields in the DataSet except that they’re listed after Fields from other Tables, and the RowMod :

  <returnValues>
    <returnParameter name="ds" type="HelpDeskTableset">
      <HelpDeskDataSet xmlns="http://www.epicor.com/Ice/300/BO/HelpDesk/HelpDesk">
        <HDCase>
          <Company>EmbedTek</Company>
          <HDCaseNum>0</HDCaseNum>
          <CustNum>0</CustNum>
          <ShipToNum></ShipToNum>
          <ShpConNum>0</ShpConNum>
          <ParentCase>0</ParentCase>
          <Description>K2 Case Entry 20170628 a - Short Description
K2 Case Entry 20170628 a - Long Description</Description>
          <ResolutionText></ResolutionText>
          <PublishedText></PublishedText>
          <PublishedSummary></PublishedSummary>
          <KBEntry>false</KBEntry>
          <PublishedItem>false</PublishedItem>
          <PartNum></PartNum>
          <SerialNumber></SerialNumber>
          <QuoteNum>0</QuoteNum>
          <OrderNum>0</OrderNum>
          <CallNum>0</CallNum>
          <ContractNum>0</ContractNum>
          <WarrantyCode></WarrantyCode>
          <Priority>0</Priority>
          <TaskSetID></TaskSetID>
          <CurrentWFStageID></CurrentWFStageID>
          <ActiveTaskID></ActiveTaskID>
          <LastTaskID></LastTaskID>
          <CaseOwner>KD</CaseOwner>
          <WFGroupID></WFGroupID>
          <WFComplete>false</WFComplete>
          <CreatedBy></CreatedBy>
          <CreatedTime>0</CreatedTime>
          <LastUpdatedBy></LastUpdatedBy>
          <LastUpdatedTime>0</LastUpdatedTime>
          <TopicID1></TopicID1>
          <TopicID2></TopicID2>
          <TopicID3></TopicID3>
          <TopicID4></TopicID4>
          <TopicID5></TopicID5>
          <TopicID6></TopicID6>
          <TopicID7></TopicID7>
          <TopicID8></TopicID8>
          <TopicID9></TopicID9>
          <TopicID10></TopicID10>
          <CaseTopics></CaseTopics>
          <MktgCampaignID></MktgCampaignID>
          <MktgEvntSeq>0</MktgEvntSeq>
          <RevisionNum></RevisionNum>
          <PartDescription></PartDescription>
          <Quantity>0</Quantity>
          <QuantityUOM>Each</QuantityUOM>
          <OrderLine>0</OrderLine>
          <OrderRelNum>0</OrderRelNum>
          <QuoteLine>0</QuoteLine>
          <CallLine>0</CallLine>
          <RMANum>0</RMANum>
          <RMALine>0</RMALine>
          <InvoiceNum>0</InvoiceNum>
          <InvoiceLine>0</InvoiceLine>
          <PrcConNum>0</PrcConNum>
          <ProjectID></ProjectID>
          <CustomerName></CustomerName>
          <PackNum>0</PackNum>
          <PackLine>0</PackLine>
          <ChangedBy></ChangedBy>
          <ChangeTime>0</ChangeTime>
          <CompletedBy></CompletedBy>
          <CompletionTime>0</CompletionTime>
          <ShipToCustNum>0</ShipToCustNum>
          <DropShipPackSlip></DropShipPackSlip>
          <DropShipPackLine>0</DropShipPackLine>
          <VendorNum>0</VendorNum>
          <PurPoint></PurPoint>
          <EquipID></EquipID>
          <EmpID></EmpID>
          <BuyerID></BuyerID>
          <VendorNumCon>0</VendorNumCon>
          <PurPointCon></PurPointCon>
          <VenConNum>0</VenConNum>
          <PurPointConNum>0</PurPointConNum>
          <UnitPrice>0</UnitPrice>
          <DocUnitPrice>0</DocUnitPrice>
          <Rpt1UnitPrice>0</Rpt1UnitPrice>
          <Rpt2UnitPrice>0</Rpt2UnitPrice>
          <Rpt3UnitPrice>0</Rpt3UnitPrice>
          <ExtPrice>0</ExtPrice>
          <DocExtPrice>0</DocExtPrice>
          <Rp1ExtPrice>0</Rp1ExtPrice>
          <Rp2ExtPrice>0</Rp2ExtPrice>
          <Rp3ExtPrice>0</Rp3ExtPrice>
          <CurrencyCode>US</CurrencyCode>
          <RateGrpCode></RateGrpCode>
          <LockRate>false</LockRate>
          <ExchangeRate>0</ExchangeRate>
          <CaseTypeID>CASE</CaseTypeID>
          <PONum>0</PONum>
          <TerritoryID></TerritoryID>
          <POLine>0</POLine>
          <WorkflowType>HelpDesk</WorkflowType>
          <POPackSlip></POPackSlip>
          <POPackLine>0</POPackLine>
          <SysRevID>0</SysRevID>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
          <HDCaseStatus>OPEN</HDCaseStatus>
          <ReqPerConID>0</ReqPerConID>
          <PerConID>0</PerConID>
          <AvailableMilestones>0`</AvailableMilestones>
          <AvailablePrcConNum>0`</AvailablePrcConNum>
          <AvailablePurPointConNum>0`</AvailablePurPointConNum>
          <AvailableShpConNum>0`</AvailableShpConNum>
          <AvailableTaskSets>AdvRplUn`Advanced Replacement Unit~DptRep`Depot Repair~OnSite`On-Site Service~PhonSup`Phone Support~RMAPart`RMA Part</AvailableTaskSets>
          <AvailableVenConNum>0`</AvailableVenConNum>
          <BaseCurrencyID></BaseCurrencyID>
          <BaseCurrSymbol></BaseCurrSymbol>
          <CaseCode></CaseCode>
          <CaseStatus>OPEN</CaseStatus>
          <ChildCases></ChildCases>
          <CurrentMilestone>0</CurrentMilestone>
          <CurrentMilestoneDesc></CurrentMilestoneDesc>
          <CustCntCorpName></CustCntCorpName>
          <CustCntEMail></CustCntEMail>
          <CustCntFaxNum></CustCntFaxNum>
          <CustCntFirstName></CustCntFirstName>
          <CustCntLastName></CustCntLastName>
          <CustCntMiddleName></CustCntMiddleName>
          <CustCntName></CustCntName>
          <CustCntPhoneNum></CustCntPhoneNum>
          <CustomerRequiresPO>false</CustomerRequiresPO>
          <DispCreateTime>00:00</DispCreateTime>
          <DispLastUpdateTime>00:00</DispLastUpdateTime>
          <DropShip>false</DropShip>
          <EvaluationStatus></EvaluationStatus>
          <EvaluationStatusDesc></EvaluationStatusDesc>
          <HDCaseNumString></HDCaseNumString>
          <Inactive>false</Inactive>
          <IssueSummary>K2 Case Entry 20170628 a - Short Description</IssueSummary>
          <IssueText>K2 Case Entry 20170628 a - Long Description</IssueText>
          <PartSalesUM>Each</PartSalesUM>
          <PPCntEmailAddress></PPCntEmailAddress>
          <PPCntFaxNum></PPCntFaxNum>
          <PPCntName></PPCntName>
          <PPCntPhoneNum></PPCntPhoneNum>
          <PurPointConName></PurPointConName>
          <ReqContextLink></ReqContextLink>
          <ReqPerConLnkID1></ReqPerConLnkID1>
          <ReqPerConLnkID2></ReqPerConLnkID2>
          <ReqPerConLnkName></ReqPerConLnkName>
          <ReqPerConLnkRowID>00000000-0000-0000-0000-000000000000</ReqPerConLnkRowID>
          <ReqPerConName></ReqPerConName>
          <ReqPrimary>true</ReqPrimary>
          <Rpt1ExtPrice>0</Rpt1ExtPrice>
          <Rpt2ExtPrice>0</Rpt2ExtPrice>
          <Rpt3ExtPrice>0</Rpt3ExtPrice>
          <ShipCntCorpName></ShipCntCorpName>
          <ShipCntEMail></ShipCntEMail>
          <ShipCntFaxNum></ShipCntFaxNum>
          <ShipCntFirstName></ShipCntFirstName>
          <ShipCntLastName></ShipCntLastName>
          <ShipCntMiddleName></ShipCntMiddleName>
          <ShipCntName></ShipCntName>
          <ShipCntPhoneNum></ShipCntPhoneNum>
          <ShipToCustID></ShipToCustID>
          <ShipToNumName></ShipToNumName>
          <TargetUOM></TargetUOM>
          <TaskCompletePasswordIsValid>false</TaskCompletePasswordIsValid>
          <TaskCompletePasswordRequired>false</TaskCompletePasswordRequired>
          <VendCntEmailAddress></VendCntEmailAddress>
          <VendCntFaxNum></VendCntFaxNum>
          <VendCntName></VendCntName>
          <VendCntPhoneNum></VendCntPhoneNum>
          <AllowMilestoneUpdate>false</AllowMilestoneUpdate>
          <AttrCodeList></AttrCodeList>
          <PricePerCode></PricePerCode>
          <BitFlag>0</BitFlag>
          <ActiveTaskIDTaskDescription></ActiveTaskIDTaskDescription>
          <BuyerIDName></BuyerIDName>
          <CaseOwnerName>Kyle Domnie</CaseOwnerName>
          <CurrencyCodeCurrName>Dollars</CurrencyCodeCurrName>
          <CurrencyCodeCurrSymbol></CurrencyCodeCurrSymbol>
          <CurrencyCodeCurrDesc>Base Currency.</CurrencyCodeCurrDesc>
          <CurrencyCodeDocumentDesc></CurrencyCodeDocumentDesc>
          <CurrencyCodeCurrencyID>US</CurrencyCodeCurrencyID>
          <CustNumBTName></CustNumBTName>
          <CustNumCustID></CustNumCustID>
          <CustNumName></CustNumName>
          <CustNumAllowShipTo3>false</CustNumAllowShipTo3>
          <DropShipDtlLineDesc></DropShipDtlLineDesc>
          <EmpIDName></EmpIDName>
          <EquipIDDescription></EquipIDDescription>
          <LastTaskIDTaskDescription></LastTaskIDTaskDescription>
          <MktgCampaignIDCampDescription></MktgCampaignIDCampDescription>
          <MktgEventEvntDescription></MktgEventEvntDescription>
          <PackLineLineDesc></PackLineLineDesc>
          <PartNumTrackDimension>false</PartNumTrackDimension>
          <PartNumSalesUM></PartNumSalesUM>
          <PartNumPartDescription></PartNumPartDescription>
          <PartNumPricePerCode></PartNumPricePerCode>
          <PartNumSellingFactor>0</PartNumSellingFactor>
          <PartNumTrackSerialNum>false</PartNumTrackSerialNum>
          <PartNumTrackLots>false</PartNumTrackLots>
          <PartNumIUM></PartNumIUM>
          <ProjectIDDescription></ProjectIDDescription>
          <ShipToCustNumName></ShipToCustNumName>
          <ShipToCustNumCustID></ShipToCustNumCustID>
          <TaskSetIDWorkflowType></TaskSetIDWorkflowType>
          <TaskSetIDTaskSetDescription></TaskSetIDTaskSetDescription>
          <TerritoryIDTerritoryDesc></TerritoryIDTerritoryDesc>
          <VendorNumConVendorID></VendorNumConVendorID>
          <VendorNumConName></VendorNumConName>
          <WarrantyCodeWarrDescription></WarrantyCodeWarrDescription>
          <WFGroupIDDescription></WFGroupIDDescription>
          <WFStageIDDescription></WFStageIDDescription>
          <RowMod>A</RowMod>
          <Character01></Character01>
          <Character02></Character02>
          <Character03></Character03>
          <ShortChar01></ShortChar01>
          <ShortChar02></ShortChar02>
          <ShortChar03></ShortChar03>
          <ShortChar04></ShortChar04>
          <ShortChar05></ShortChar05>
          <ShortChar06></ShortChar06>
          <Character04></Character04>
          <Character05></Character05>
          <Character06></Character06>
          <ShortChar07></ShortChar07>
          <ShortChar08></ShortChar08>
          <ShortChar09></ShortChar09>
          <CFR_c></CFR_c>
          <CaseWorkFlag_c>false</CaseWorkFlag_c>
          <CaseResult_c></CaseResult_c>
        </HDCase>
      </HelpDeskDataSet>
    </returnParameter>
  </returnValues>

I’m able to add values to the DataSet for the other HDCase Fields I need with no errors, and the data is saved in the new Case, for example :

adapterHelpDesk.HelpDeskData.HDCase[ 0 ].IssueSummary = epiTextBoxHDCase_IssueSummary.Text;

When attempting to set a value for Character01 ( HDCase_UD.Character01 ) :

adapterHelpDesk.HelpDeskData.HDCase[ 0 ].Character01 = epiTextBoxHDCase_Character01.Text;

the Compiler complains :

‘Erp.BO.LaborDataSet.LaborDtlRow’ does not contain a definition for ‘Character01’ and no extension method ‘Character01’ accepting a first argument of type ‘Erp.BO.LaborDataSet.LaborDtlRow’ could be found

I tried this with one of our user-defined fields, CaseResult_c, with, as expected, the same result except for the Field name in the compiler error.

I’ve tried several variations of the syntax, all result in essentially the same compiler error. Here are a few :

adapterHelpDesk.HelpDeskData.HDCase_UD[ 0 ].Character01 = epiTextBoxHDCase_Character01.Text;
adapterHelpDesk.HelpDeskData.HDCase[ 0 ].Character01 = epiTextBoxHDCase_Character01.Text;
adapterHelpDesk.HelpDeskData.HDCase[ 0 ].CaseResult_c = epiTextBoxHDCase_Character01.Text;
adapterHelpDesk.HelpDeskData.HDCase[ 0 ].UserDefinedColumns[ "Character01" ] 
 = epiTextBoxHDCase_Character01.Text;
adapterHelpDesk.HelpDeskData.HDCase[ 0 ].UD[ "Character01" ] = epiTextBoxHDCase_Character01.Text;
adapterHelpDesk.HelpDeskData.HDCase[ 0 ]._UD[ "Character01" ] = epiTextBoxHDCase_Character01.Text;

I checked another Adapter in case this was an issue with the HelpDesk Adapter, and had a similar result :

adapterLabor.LaborData.LaborDtl[ ( adapterLabor.LaborData.LaborDtl.Count - 1 ) ].Character01 = "Depot";

‘Erp.BO.LaborDataSet.LaborDtlRow’ does not contain a definition for ‘Character01’ and no extension method ‘Character01’ accepting a first argument of type ‘Erp.BO.LaborDataSet.LaborDtlRow’ could be found

I tried a Field from another Table ( WFStage.Description ) found in the HelpDeskData DataSet, and that line compiles without error :

adapterHelpDesk.HelpDeskData.HDCase[ 0 ].WFStageIDDescription = epiTextBoxHDCase_Character01.Text;

Logically, I should be able to reference the HDCase_UD Table fields from the HelpDeskData Dataset, as they’re returned in that DataSet without any qualifiers.

Is there a way to reference a Field from HDCase_UD via the HelpDesk Adapter ?

As a last resort, I could fall back on creating an EpiDataView just to write to that field, but since the Field is already in the HelpDesk DataSet and “should” be accessible, adding a kludge for that Field shouldn’t be necessary.

Thanks for any information,

Ken Brunelli

just do

adapterHelpDesk.HelpDeskData.HDCase[ 0 ]["Character01"] = "XXX";

:slight_smile:

2 Likes

Arrgh…you could at least “try” to make it look difficult :wink:

I hadn’t thought of dereferencing ( sic ) the Field itself in quite that way - I assumed the Field always had to be “dotted” after the Row identifier. Your way works just fine.

Thanks for clearing that up, Jose.

Ken

1 Like

Epicor doesn’t re-create the Adapter’s or BO’s data models on the fly (that would be difficult for many reasons) so only the standard fields show up as Dotted properties. Anything custom is an additional column in the DataSet and can be addressed by name

1 Like

Jose is correct. If we change the strongly typed data structures - that means breaking every client using the service. Add a UD column, destroy every integration. I can think of a few complaints folks may have on that one.

The work around is as you see - a late bound look up into the structures. If you look at the definition of the services from the wsdl for SOAP or via REST you will note that there is a collection defined on the base class for all rows. The collection allows for a UD column per item in the collection - a name value pair of the ud column name and its value. With this approach you can send any amount of additional UD columns without breaking contracts.

It IS a pain on the client side to have to do the late bound. I have had customers generate a strongly typed dataset in their integration, morph the dataset over to the strongly typed version and write their code in that way. That works fine but they manage the deployment of their strongly typed dataset. I’d love to tackle this in customization within the product but that’s deploying a lot of moving parts for the UD columns. We are getting some infrastructure in place in this area for some new capabilities but nothing to advertise yet.

4 Likes

If you want to test if a UD column exists you can use this

<TableSetName>.<Table>[rowNum].UserDefinedColumns.ContainsKey("<YourUDField">);

if( epiDSJobClosingTableSet.JobClosing[0].UserDefinedColumns.ContainsKey("Character01") )
{
 //do thing
}
2 Likes

The suggestions work fine when I’m working with updating an existing record. However, how do I create/add a brand new record and populate the UD fields?
Here’s the lines of code I’m having a problem with (they worked in E9, but the UD fields were part of the CRMCall table):

                              baseCRM = new Erp.BO.CRMCallDataSet();

                              DataRow n = baseCRM.CRMCall.NewRow();

If I loop through all the datacolumns in the baseCRM DataSet, all of the UD columns are listed. But when I create a NewRow for the CRMCall table, it does not include any of the UD fields. If I try to assign a value to a UD field I get the error …“Does not contain a definition for” all of the UD fields I try to assign (even using the [“”] syntax.
So I’m stumped when trying to add a new record and populate the UD fields.
Any help would be greatly appreciated.

Thanks,
Steve Sterling