Dynamics CRM: The state transition requested is not valid for the current state. Current state: 3, current status: 32, target state: 3 - plugins

I developed a plugin(to create a contact) and installed profiler using 'Plugin Registration Tool'.
When I create raw contact, my plugin suppose to insert that raw data into Contact. But I get an error message at 'Settings -> System Jobs' with Status Reason 'Waiting'.
Error Message :
The state transition requested is not valid for the current state. Current state: 3, current status: 32, target state: 3.
I'm new to Dynamics CRM, Can anyone share thoughts on this?

The StatusCode is like a dependent picklist based on the StateCode.
For example on Opportunities, only when the StateCode is "Won" (1) can we set the StatusCode to "Won" (3). And, only when the StateCode is "Lost" (2) can we set the StatusCode to "Canceled" (4).
If you try to set the StatusCode to "Won" (3) with a StateCode of "Open" (0), you'll get the same type of error as you're seeing.
The Contact entity typically has very few State and StatusCodes, but the SystemJob entity has many (as shown here).
The fact that you're seeing a StatusCode of 32 is a strong clue that it's related to the SystemJob rather than the Contact. For the record, the StatusCode of 32 on a SystemJob indicates a StateCode of Completed with a StatusCode of Canceled.

Related

Error report for execution and query intent in the test suite of the google action

Our project passed “Turn on” execution and query in the test
suite of the google action.
But “Turn off” execution and query failed and I couldn’t find in our part.
After “Turn off” execution, I responded “false” for “on” attribute but
error report was shown - actual state: {"on":true,"online":true}.
Below is the exchanged data and the error report.
Google action request for execution:
{"inputs":[{"context":{"locale_country":"US","locale_language":"en"},"intent":"action.devices.EXECUTE","payload":{"commands":[{"devices":[{"id":"eg_cam_87901"}],"execution":[{"command":"action.devices.commands.OnOff","params":{"on":false}}]}]}}],"requestId":"960820806239759768"}
Our Response for execution:
{"requestId":"960820806239759768","payload":{"commands":[{"ids":["eg_cam_87901"],"status":"SUCCESS","state":{"online":false,"on":false,"currentToggleSettings":null}}]}}
Google action error report
Turn off the bedroom
AssertionError: Expected state to include: {"on":false}, actual state: {"on":true,"online":true}: expected false to be true
Google action request for query:
{"inputs":[{"intent":"action.devices.QUERY","payload":{"devices":[{"id":"eg_cam_87901"}]}}],"requestId":"4409204964431192716"}
Our Response for query:
{"requestId":"4409204964431192716","payload":{"devices":{"eg_cam_87901":{"online":false,"status":"SUCCESS","on":false,"currentToggleSettings":null}}}}
Google action error report
Query after 'Turn off the bedroom'
Error: the string "Error from HA: deviceOffline" was thrown, throw an Error :) at new f (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18143:10) at Runner.fail (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:4491:11) at js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:4802:18 at done (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:4189:5) at js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:4236:11 at w.Ic (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18137:24) at r.run (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18129:169) at js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18171:310 at w.Jl (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18137:454) at r.Ms (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18130:301) at h (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18126:375) at y.Jl [as Ic] (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18139:326) at q (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18167:89) at e (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18158:235) at XMLHttpRequest.w (js/app_compiled.js?f77b3b67-f1c5-4a38-8a20-fe5eafbc2c40:18167:241)
You've got a couple issues here.
First, you need to verify that your sync response includes the appropriate device attributes - your execution/query responses both return NULL for your currentToggleSettings instead of the string of the availableToggles in your sync response. If you are just using OnOff for your device, you don't actually even need to implement any of the Toggle trait features. Again, verify what is in your initial sync response.
Second, you're returning online: false as well as on:false, which is why you're getting the following error:
Error: the string "Error from HA: deviceOffline" was thrown
online:false should only be used when you intend to return the TTS response of "the device is not available right now" when a user issues a command/query, and when the device cannot be controlled. This should also include status:ERRROR in your response. You can read more about handling errors and exceptions in the docs.
Returning online:true, on:false or online:true, on:true when responding to an execute/query request should fix the deviceOffline error.

Rest API Response Error Code for when a related resource has a blocked state

Which 400-level response code is most appropriate when a user that has permission to POST a target resource, but one of the dependent resources' status causes the target resource not to be created.
Example:
Entity1
id: 'A',
status: 'BLOCKED'
Entity2:
id: 'B'
LinkEntity:
entity1Id: 'A'
entity2Id: 'B'
Result when POSTing LinkedEntity: 'Error: Cannot link to Entity1 because it is BLOCKED'
Which Response Code is best to use in this case?
The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource.
It sounds like a permission-related issue. For this case 403 Forbidden is probably best.

Workday: Put_Customer returning an error

We are using Snaplogic to load records into workday. Currently, extracting customer records from the source and trying to load them into workday using the object Put_Customer of web service Revenue_Management.
I was getting the following error:
But I'm not getting any category information from the source. So, I tried putting the value for Customer_Category_Reference as 1. But I ended up getting the following error.
The documentation for workday is not helpful and this has been a blocker for me for some time now.
Any help will be appreciated.
Update:
Trying to get customer categories using the Get_Customer_Categories object of Revenue_Management web service using Snaplogic. But getting the following error:
Failure: Soap fault, Reason: Processing error occurred. The task submitted is not authorized., Resolution: Address SOAP fault message and retry
Unfortunately I don't have access to a tenant at this time to validate . However it is likely to work based in prior experience . Perhaps you could create a customer in Workday, through the GUI. Then do get customer API call. Note the category reference . Then, use that in your put customer call
If you look at the API documentation, you will find that Put_Customer accepts a WID in the Customer_WWS_Data object. If you search for "Customer Categories" in Workday, you will likely find the report of the same name. Just select the category that you want your newly loaded customers to default to (click on the magnifying class, then on the ellipsis, Integration Ids, View Ids). The Workday ID will appear at the top.
I have not used the Revenue Management API, but my code for creating a position reference in the Compensation API is probably very similar to what you need to do for the Customer Category reference:
public static Position_ElementObjectType getPositionReference(string WID) {
return new Position_ElementObjectType {
ID = new Position_ElementObjectIDType[] {
new Position_ElementObjectIDType {
type = "WID",
Value = WID
}
}
};
}

Event MyEvent has ID 2 which is already in use

I am implementing event tracing using EWT in a Service Fabric application and are faced with these errors
ERROR: Exception in Command Processing for EventSource MyCompany-ServiceFabricApplication-LiveDataReader: Event OnCommandMessageReceived has ID 2 which is already in use
The "OnCommandMessageReceived" is my custom event
[Event(2, Level = EventLevel.Verbose, Message = "Queue client created '{0}'")]
public void OnQueueClientCreated(string queueClientName)
{
if (IsEnabled())
{
WriteEvent(2, queueClientName);
}
}
I have multiple/many of these errors and I have tried to messing around with numbers but ...
Is there some Powershell command or else that can tell what IDs are in use or is there a safe range or something?
PS: When that event is fired i can see it in visual studio diagnostic events viewer but the Message is empty. It would be cool if it displayed the message from the payload. Is that possible?
ETW Events must have an unique ID per provider. So look if you have other events with ID 2 and change tie ID to a different value.

Getting information on ride requests in sandbox mode

Using Uber's API, I managed to make a trip request, and then change it's status to accepted via the PUT command described in the docs.
However, if afterwards I make a GET request to fetch ride's attributes, I get status = accepted, but driver, eta, location and vehicle are null. Thus, I can't test that the whole flow works.
Am I missing something?
Actually, once the trip in sandbox mode is set to status "Accepted" you should be able to see all those attributes. I just tested this myself and it worked fine.
The flow I followed was:
1) POST to https://sandbox-api.uber.com/v1/requests (with the proper params and auth headers) to create a sandbox trip
2) PUT to https://sandbox-api.uber.com/v1/sandbox/requests/{trip_UUID from step 1) with JSON body: {"status": "accepted"}
3) GET https://sandbox-api.uber.com/v1/requests/current OR GET https://sandbox-api.uber.com/v1/requests/{trip_UUID from step 1}
Could you provide some more details on the exact flow you followed?
According to the /v1/requests/{request_id} endpoint documentation
Note: The following fields are populated only when a trip is active:
driver
vehicle
pickup
destination
The meaning of the "accepted" status is:
accepted The Request has been accepted by a driver and is "en route"
to the start location (i.e. start_latitude and start_longitude).
I think by "trip is active" they mean the request status needs to be in_progress
in_progress The Request is "en route" from the start location to the
end location.
Try to change the status of the request to in_progress using the PUT /v1/sandbox/requests/{request_id} sandbox endpoint.
After this you should be able to get access to the driver, vehicle, pickup and destination fields.