Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcoded values for organization for CDS connectors of type dynamicscrmonline #104

Open
dhrumeshgandhi opened this issue Mar 11, 2021 · 8 comments

Comments

@dhrumeshgandhi
Copy link

dhrumeshgandhi commented Mar 11, 2021

We are facing issue with exporting template of Logic app which contains older dynamicscrmonline typed connectors.
We have action as shown in below:

"Create_error_log": {
    "inputs": {
        "body": {
            <Some Parameters>
        },
        "host": {
            "connection": {
                "name": "@parameters('$connections')['dynamicscrmonline']['connectionId']"
            }
        },
        "method": "post",
        "path": "/datasets/@{encodeURIComponent(encodeURIComponent('orgxxxxxxx.crm4'))}/tables/@{encodeURIComponent(encodeURIComponent('accounts'))}/items"
    },
    "runAfter": {
        "Scope": [
            "Failed",
            "Skipped",
            "TimedOut"
        ]
    },
    "type": "ApiConnection"
}

When we export template from this using Get-LogicAppTemplate cmdlet, it is exported as is and no parameters are exported.
We want to make CE organization ("orgxxxxxxx.crm4") to be replaced with parameter.
Please let me know if any more information is required.

@dhrumeshgandhi
Copy link
Author

We are also facing this issue with the CDS connectors of type commondataservice if there not v2.

Found the issue: there is no switch case for dynamicscrmonline type of connector in handleActions method (for both actions and triggers) of TemplateGenerator.cs and also there is static code to fetch dataset from path, which doesn't work when the connector is not v2 for actions or not v1 for triggers.

Solution that i found: Add a fall through case for "dynamicscrmonline" connector to the commondataservice case and update the logic to select dataset name to dynamic from static. Following code works for dynamic selection:

var dataset = "";
var datasetIndex = Array.FindIndex(pathsubsets, pathsubset => pathsubset == "datasets") + 1;
if (datasetIndex < pathsubsets.Length)
{
      dataset = pathsubsets[datasetIndex];
}

Gist for updated TemplateGenerator.cs

Please go through the change and correct if feasible.

Thanks in advance.

@dhrumeshgandhi
Copy link
Author

dhrumeshgandhi commented Jun 1, 2021

We are also facing this issue with the CDS connectors of type commondataservice if it is not v2.

Found the issue: there is no switch case for dynamicscrmonline type of connector in handleActions method (for both actions and triggers) of TemplateGenerator.cs and also there is static code to fetch dataset from path, which doesn't work when the connector is not v2 for actions or not v1 for triggers.

Solution that i found: Add a fall-through case for "dynamicscrmonline" connector to the commondataservice case and update the logic to select dataset name to dynamic from static. The following code works for dynamic selection:

var dataset = "";
var datasetIndex = Array.FindIndex(pathsubsets, pathsubset => pathsubset == "datasets") + 1;
if (datasetIndex < pathsubsets.Length)
{
      dataset = pathsubsets[datasetIndex];
}

Gist for updated TemplateGenerator.cs

Please go through the change and correct if feasible.

Thanks in advance.

Can anyone help us with this? @MLogdberg @jeffhollan

@MLogdberg
Copy link
Collaborator

Sorry for late response, totaly fell out of scope. I'll take a look at this, solution looks good at a first glance.

@dhrumeshgandhi
Copy link
Author

@MLogdberg, Thanks for replying.

And can you please confirm if support for azure function action will be added or not?

@MLogdberg
Copy link
Collaborator

Should be solved via #111
What is the functions support you are refering to? @dhrumeshgandhi

@dhrumeshgandhi
Copy link
Author

Should be solved via #111
What is the functions support you are refering to? @dhrumeshgandhi

We are using Azure functions in our logic apps, which are not parameterized while using LogicAppTemplateCreator.

@MLogdberg
Copy link
Collaborator

Yea I use it alot aswell, when I do extractions it's parameterized as follow, are you missing anything there?

"INT119A-CreateQuoteD365": { "runAfter": {}, "type": "Function", "inputs": { "body": "@outputs('Compose_body')", "function": { "id": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('INT119A-CreateQuoteD365-ResourceGroup'),'/providers/Microsoft.Web/sites/',parameters('INT119A-CreateQuoteD365-FunctionApp'),'/functions/',parameters('INT119A-CreateQuoteD365-FunctionName'))]" } } } },

@dhrumeshgandhi
Copy link
Author

Is this the same DLL that we get when we install the module from PS Gallery using Install-Module -Name LogicAppTemplate? Because when we tried to parameterize the azure function it didn't work so instead we switched to HTTP action to call the Azure function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants