Skip to main content

Notifications

Finance forum
Suggested answer

Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

Posted on by 1,204

Hi,

I extended FreeTextInvoiceHeaderEntity and add a simple oData action method.

[ExtensionOf(tableStr(FreeTextInvoiceHeaderEntity))]
final class FreeTextInvoiceHeaderEntity_Test_Extension
{
    /// 
    /// Infolog
    /// 
    [SysODataActionAttribute('Post', true)]
    public void post()
    {
        info('FreeTextInvoiceHeaderEntity-Post');
    }

}

Then I create a power automate flow with Fin & Ops connector. In Execute Action, I'm unable to see my custom method to run in the flow.

I made sure to refresh entity list, restart DIXF service in DEV environment, but still the action method is not visible.

What am I missing? As far as I know, adding SysODataActionAttribute to the method is the only thing we need to do.

I was referring to official documentation here https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/odata#exposing-odata-entities .

Thank you.

  • HAIRUL HAZRI Profile Picture
    HAIRUL HAZRI 1,204 on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hi Andre,

    After:

    1. changing 2nd argument of the action attribute to false

    2. Change the method to static

    the flow run successfully.

        [   
            SysODataActionAttribute("testPost", false)
        ]
        public static str testPost()
        {
        }

    But I still don't understand what's going on here. What does the 2nd argument & static method have to do with the "NOT FOUND" error?

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 284,874 Super User on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hi Hairul,

    I noticed another action which returns a string value in the standard application. This is having another code pattern as start of the method, e.g.:

    [
        SysODataActionAttribute('getBusinessEventsCatalog', false),
        SysODataCollectionAttribute('return', Types::String)
    ]

    It is explicitly mentioning the expected return type. You can try to align it with this example to see if it helps here.

  • HAIRUL HAZRI Profile Picture
    HAIRUL HAZRI 1,204 on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hi Kevin,

    thank you for your suggestion. I changed the action attribute name. However, the error persists. I even tried to:

    1. Restart IIS express

    2. Restart DIXF service

    3. Refresh entity list in Data Management

    4. Delete and recreate the flow

    But still unable to get past the error. Do you know any other possible cause? Thank you.

  • Suggested answer
    zhifeng Profile Picture
    zhifeng on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hello HAIRUL ,

    Can you change method name to testPost in below code? 

    [SysODataActionAttribute('testPost', true)]

  • HAIRUL HAZRI Profile Picture
    HAIRUL HAZRI 1,204 on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Thank you Nikolaos for pointing that out.

    Hi Andre,

    I simply use ExecuteAction action in Fin & Ops connector and call the method. This is my first time discovering oData action, so I'm testing in a cloud hosted DEV environment:

    3542.executeaction-setup.png

    Inside the method is just a simple infolog and return a string;

    public class FreeTextInvoicePostingEntity extends common
    {    
        /// 
        /// Infolog
        /// 
        [SysODataActionAttribute('TestPost', true)]
        public str testPost()
        {
            info('FreeTextInvoicePostingEntity-TestPost');
    
            return 'Test OData action here. Success.';
        }
    }

    After build the entity, I check the action metadata exists:

    executeaction-metadata.png

    But the flow output returns "not found" error:

    executeaction-output.png

    I don't understand what is the problem here. What am I still missing?

    Thank you.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 284,874 Super User on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hi Hairu,

    Can you show how you did setup this action in your flow? What type of environment are you using here?

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,146 on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hi,

    this doc page says: "OData actions added via extensions are currently not supported."

    docs.microsoft.com/.../odata

    How to create OData actions in your entities? You should find plenty of blogs, discussions and examples by searching the web.

  • HAIRUL HAZRI Profile Picture
    HAIRUL HAZRI 1,204 on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    Hi Nikolaos,

    that's strange. Doesn't seem documented anywhere.

    Anyway, I duplicated FreeTextInvoiceHeaderEntity, and created the same method as above.

    Then I tried to create a simple flow to run the execute action. Seems like custom action in custom entity is usable now.

    However, even after refresh entity list, running the action returns "NotFound" error:

    executeaction.png

     How to properly create a successful action? Ultimately, I want to perform free text invoice posting on the action method, but for starters I just want to test a simple action, hence only the infolog.

    If you have any example that I can refer, please share. Thank you.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,146 on at
    RE: Add 'Action' Method on Data Entity to Expose to Flow Fin & Ops Connector 'Execute Action'

    As far as  I know, you can't add OData actions to existing entities via extension.

Helpful resources

Quick Links

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284,874 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,425 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans