HTTP Get to compare to Dataverse fields - power-automate

HTTP Get to compare to Dataverse fields
an hour ago
I'm having trouble with my flow. I'm not sure whether to have this flow as scheduled or not at the moment. There's an external database that contains a field for a name that I need. This is collected by another piece of software. In my Dataverse table I don't have the name, but I need it.
So I'm trying to get it by using an HTTP Get request. I'm trying to compare the CustomerID from each row in the HTTP request to the CustomerID in the Dataverse table (these match up). If the CustomerIDs match up, the name is put into the Dataverse table using Update a row.
Here is what I have so far
-Dataverse list rows
-HTTP Get
-Parse JSON HTTP body
-Apply to each CustomerID from Parse JSON
-Apply to each value from list rows
-Condition - if JSON CustomerID = Dataverse CustomerID
-Update row. RowID = CurrentItem
Nothing seems to work. I've had a variety of errors.
Is there a better method to achieve this?
Thank you

Related

Get RITM number attached to Change request in Service Now

I am trying to get the Request number (RITM) that is attached in the Change Request (CR) in service now. I am able to get the Request number but not able to get for which Change Request the corresponding Request number is attached. I have used the table "sc_req_items" to get the Request number and "Change_request" table to get the Change request number.
Service now screenshot
I need the ritm number corresponding to the Change Request (CR) in the screenshot. how to get this?
There is a Out Of The Box/Baseline Related list available on the Change Request table. The query that this Related List is using is the Parent field:
parent=<sys_id/GUID for the change record>^.
If Parent (reference field) is not the link between your objects then you need to map what the link is, is it another field or an m2m table.

Using PowerAutomate, how do you check for unique values between davaverse table and http request?

What I am trying to do:
Check http response against my current table in davaverse to only add unique values to current table. In JavaScript you'd just use a new Set but I am new to power apps and don't know how to get same results.
Example of flow I am trying to do:
Http request
↓
Parse Json
↓
Compare data from request with current table items
Example:
For each row
If response contact name != contact name in table
&&
If response ID != ID in table
&&
If response type != type in table
Then add response data to table
Problems:
Currently, I do not know how to add the dataverse table to check row data vs request data. I see an action for "relate rows" but seems like I'd have to create a table with response data to use it.. which should be an extra step.
If using a function, I would believe I would have to use an expression with contains(). If this is the route; How do I add my table as the collection part of contains expression?

How to fetch the variable value in service now when ordering item from service catalog?

I have successfully ordered an item from service catalog using REST API. While ordering I sent a JSON data in the request body containing certain key value pairs which are meant to be stored in variable of the catalog item. After the successful order, the response generated contains the sys_id, request_number, request_id, table name. Now, when I want to fetch the values passed to variables, the only way available is to make a GET call using the REST API for Tables. So, I am fetching the record using the generated sys_id and table name which is generated as response of order API. The table name is sc_request.
But that is not providing the variable value information in the response body of the GET call.
You should be able to get the values of variables using the Table API. If you go to the REST API explorer in ServiceNow, notice the field "sysparm_fields". put the name of your variabe(s) in there like this "variables.var_name". This will retrieve their values and display values in the response.

RESTful API - validation of related records

I implementing RESTful API service and i have a question about saving related records.
For example i have users table and related user_emails table. User emails should be unique.
On client side i have a form with user data fields and a number of user_email fields (user can add any number of fields independently). When the user saves the form i must first make query to create record in users table to get her ID, ​​and only then i can make query to save user emails (because in now i have id of record which come with response after saving user data). But if user enters not unique email in any field then the request will fail. So I create a record in the users table but not create record in user_emails table.
What are the approaches to implement validation of all this data before saving?
This is nor related restful api but transactional processing on the backend. If you are using Java, with JPA you can persist both element in the same transaction then you can notice if there is a problem and rollback the entire transaction returning a response.
I would condense it down to a single request, if you could. Just for performance's sake, if nothing else. Use the user_email as your key, and have the request return some sort of status result: if the user_email is unique, it'll respond with a success message. Otherwise, it'd indicate failure.
It's much better to implement that check solely on the server side and not both with the ID value unless you need to. It'll offer better performance to do that, and it'll let you change your implementation later more easily.
As for the actual code you use, since I'm not one hundred percent on what you're actually asking, you could use a MERGE if you're using SQL Server. That'd make it a bit easier to import the user's email and let the database worry about duplicates.

breeze.js insert parent/child with identity

Simple parent/child scenario like Order and OrderLineItems. I am inserting a new Order, the OrderID is an identity column (sql server). I'm also inserting OrderLineItems in the same SaveChanges transaction. I need to get the new OrderID into the OrderLineItems, but not sure how to do it. I have the appropriate FK relationships setup properly. When I save, I get an error that OrderID is a required field in OrderLineItems.
Will I have to split this out into 2 server calls? First to insert the Order, which will return the OrderID. And then another to insert the OrderLineItems?
The Breeze documentation discusses this topic (key generation) at several points including but not limited to: http://www.breezejs.com/documentation/save-changes, http://www.breezejs.com/documentation/extending-entities and http://www.breezejs.com/documentation/add-new-entity.
The basic idea idea is that providing that your model and metadata are set up properly, breeze can assign a temporary id in place of the identity column for use in linking your order and orderlineitem entities prior to being saved. As part of the save process, Breeze updates these temporary keys to their "real" key values and updates the local cache as well upon successful completion of the save.

Resources