FDC3 icon indicating copy to clipboard operation
FDC3 copied to clipboard

[Draft] Context Proposal: TransactionResult

Open milindchidrawar opened this issue 2 years ago • 0 comments

Enhancement Request

Use Case:

Users that create, update or delete records remotely from another FDC3 enabled application will need a way of knowing the outcome of their request so that they can either continue with their workflow or rectify the issue (e.g.- record doesn't exist, duplicate records exist)

For example:

Following a conversation in an instant messaging application, a user would like to create an interaction. It would be helpful to know whether or not the interaction was created successfully

Contexts

TransactionResult

The result of any given create, update or delete intent.

Details
Property Type Required Example Value
type Context Yes See Below
status string Yes 'Updated'
context string Yes See Below
message string No See Below
Example
const contact = {
    type: "fdc3.contact",
    name: "Jane Doe",
    id: {
        email: "[email protected]"
    }
}

const resolution = await window.fdc3.raiseIntent('CreateOrUpdateProfile', contact);
const result = await resolution.getResult();
console.log(JSON.stringify(result));

Console log will display:

{
    "type": "fdc3.transactionResult",
    "status": "Updated",
    "context": {
        "type": "fdc3.contact",
        "name": "Jane Doe",
        "id": {
            "email": "[email protected]"
        }
    },
    "description": "record with id [email protected] was updated"
}

Additional Information

Statuses should be one of the following: "Created", "Deleted", "Updated", "Failed" Although message is marked as Optional, we recommend the use of this attribute for failure reasons so that users know how to resolve the issue (e.g.- create a missing contact, remove a duplicate contact)

milindchidrawar avatar Jul 06 '22 08:07 milindchidrawar