web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

Add field EcoResProductCreate Form

(0) ShareShare
ReportReport
Posted on by 4
Hi, I would like to add the description field from EcoResProductTranslation table in EcoResProductCreate form
 
I extended this method to map the field to EcoResProductTranslation table.
    protected void createData2Controls()
    {
        next createData2Controls();
        data2Controls = conIns(data2Controls,
                                conLen(data2Controls) + 1,
                                [tableStr(EcoResProductTranslation), [[fieldNum(EcoResProductTranslation, Description), formControlStr(EcoResProductCreate, WTIProductDescription)]]]);
    }

I get this error: Function EcoResProductCreate.getBufferByDataSourceName has been incorrectly called.

This is where I'm blocked. I want to add this table in switch case of getBufferByDataSourceName method, but this method is private, I can't extend it.

Any help or ideas would be really appreciated, 
 
thanks!
Claudia
 
I have the same question (0)
  • Community member Profile Picture
    4 on at
    Ok the solution to this was to use the delegate method in the switch case (default case)
                default:
                    EventHandlerResult result = new EventHandlerResult();
                    this.getBufferByDataSourceNameDelegate(_formDataSourceName, _itemId, _forUpdate, result);
                    if (!result.hasResult())
                    {
                        throw error(Error::wrongUseOfFunction(funcName()));
                    }
                    common = result.result();

    We need to create a subscribed method

    1- create a class
    2- Add a subscribe method, that subscribes to getBufferByDataSourceNameDelegate delegate
     
        [SubscribesTo(formStr(EcoResProductCreate), delegateStr(EcoResProductCreate, getBufferByDataSourceNameDelegate))]
        public static void EcoResProductCreate_getBufferByDataSourceNameDelegate(str _formDataSourceName, ItemId _itemId, boolean _forUpdate, EventHandlerResult _result)
        {
            EcoResProduct               ecoResProduct;
            select RecId from ecoResProduct
                where ecoResProduct.DisplayProductNumber == _itemId;
            if(ecoResProduct)
            {
                EcoResProductTranslation    ecoResProductTranslation = EcoResProductTranslation::findByProductLanguage(ecoResProduct.RecId,companyinfo::languageId(),_forUpdate);
                _result.result(ecoResProductTranslation);
            }
        }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Siv Sagar Profile Picture

Siv Sagar 303 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 144 Super User 2025 Season 2

#3
Laurens vd Tang Profile Picture

Laurens vd Tang 91 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans