# Operations in OData machine steps

## Entities folder

### Read -operation

Reading entityset is done using Read operation which is located directly under each entityset folder, example is how to read Active Work Orders (entityset ActiveSeparateSet). &#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FVjP5OFSHySPIkRNh65nN%2Fimage.png?alt=media&#x26;token=26b5555e-be26-4bd1-9276-1c70e3eae204" alt=""><figcaption></figcaption></figure>

### Get by key -operation

Get by key operation if operation which requires entity key as only parameter. **This operation does not return any reference entities, only attributes belonging to entity.**

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FPGqhnA1p1cpiH0KbwtFP%2Fimage.png?alt=media&#x26;token=d84ab3bf-62a7-492f-980e-72f4b824b1e9" alt=""><figcaption><p>Get by key - Get one Company Employee</p></figcaption></figure>

{% hint style="info" %}
If the operation requires an ETag value in request header, for example when updating single Entity, the Get by key operation is the only Get operation that returns an ETag.
{% endhint %}

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FSL6CWbuj9Rm05R3RjRT8%2FETag%20get.png?alt=media&#x26;token=1632b237-a022-4b0f-8b69-dd70db101d0f" alt=""><figcaption><p>ETag</p></figcaption></figure>

### Insert, Update, Delete -operations

Generic operations for Create, Insert and Delete operations are located directly under each entity set folder.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FI33ppQ7mysoqt0oisZZl%2Fimage.png?alt=media&#x26;token=30bae01d-955d-4db1-9bda-de590a21078c" alt=""><figcaption></figcaption></figure>

### \<Entity>\_Default (from set) -operation

Prior creating new entity user might benefit from getting default parameters to be used in Create operation.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2Fe7Nu6j8CmlIyWf5JMrzR%2Fimage.png?alt=media&#x26;token=d314c4b0-702f-426e-8ffa-007ed4b1da97" alt=""><figcaption><p>Default values for creating new PartCatalog entity</p></figcaption></figure>

The operation do not require any input parameters and returns a single record.

### Batch Create Entity

Some entities may contain `Batch Create <EntitySet> and add owned collections` operation for creating single entity and reference entities in one call in flow. The example operation creates one Functional Equipment object and several reference entities in one call. These kind of operations are provided by the OData Connector and thus cannot be found from API Explorer.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FLWhRHiwZGCE53nmWcfFn%2Fimage.png?alt=media&#x26;token=bf532f77-fd45-4bd6-b443-28c35798aa39" alt=""><figcaption></figcaption></figure>

In the machine step, provide required parameters for the new equipment and optional amount of reference entities.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F9x4RDYm0rqw2Xm1PemhK%2Fimage.png?alt=media&#x26;token=242f8b1f-7028-42c5-bfaa-d1d16de815f5" alt=""><figcaption></figcaption></figure>

### Bound actions

Bound actions are actions that are linked to a certain entity and are located under the Entities folder. Bound actions can be generally be thought of as RMB operations executed in Aurena against an entity. For example changing status on a Work Order.&#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FSYW2LSFn66NIa8wiIieN%2Fimage.png?alt=media&#x26;token=a6051c99-985e-422f-b83f-3ee83ce8db0e" alt=""><figcaption><p>Cancel Work Order</p></figcaption></figure>

Operation *ActiveSeparate\_Cancel (from entity)* is called.&#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F3wULl7RyCF3ipuPlHxB9%2FBoundActions.png?alt=media&#x26;token=537a2fe3-6580-4b2b-a297-5486fb00a016" alt=""><figcaption><p>Example of active work order bound actions</p></figcaption></figure>

### Reference Entity CUD operations

Reference entity sets can be created, deleted or updated in the context of a certain entity. In the example; Add to Notes to Work Order. &#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FPfctwJuDkh4pAApsuFcX%2Fimage.png?alt=media&#x26;token=4db10029-8396-4bbb-9c60-f6579e1f43f4" alt=""><figcaption></figcaption></figure>

Parameters require to identify the entity (Work Order no) to which the notes are added.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FwyjQtQ1uQsAkz4jL0hDE%2Fimage.png?alt=media&#x26;token=712b88cc-d40a-4fe4-bae7-363e71e677e8" alt=""><figcaption><p>Parameters for Add to WorkOrderNotesArrst</p></figcaption></figure>

### Reference Entity Batch

Batch Add operation reduces the need to create a single entities loop in flow -> reduces execution time. These kind of operations are provided by OData Connector and thus cannot be found in the API Explorer.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F94CxwiXBnzmQKZGtJCk9%2Fimage.png?alt=media&#x26;token=3abe2373-dad9-484c-89a6-4f621d9d104c" alt=""><figcaption><p>Batch Add to DetailNotes</p></figcaption></figure>

### List of values related operations

#### Lookup LOV EntitySet

Each projection may or may not have operations prefixed with Lookup.&#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FphglWuTg2ExaEY7QB0T8%2Fimage.png?alt=media&#x26;token=b9347246-b316-4c78-b04c-ce6c7e64985f" alt=""><figcaption><p>Lookup_IsoCountry operation</p></figcaption></figure>

For example when you create new customer, the new Customer page in Aurena is initiated with a LOV of static list countries using Lookup\_IsoCountry\_EntitySet Read operation.&#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FHdWtQF0SDiuBEcv2wFDT%2FLOVAurena.png?alt=media&#x26;token=4e4c261f-82d9-4464-8f73-08ad9bee4f69" alt=""><figcaption></figcaption></figure>

#### Reference  LOV EntitySet

Projection may or may not include separate operations to fetch LOVs for references linked to entityset.

Reference operations are designed for Aurena pages to produce searchable LOVs.&#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F7c1SywZr8q8H0FY12B9k%2FRefInAurena.png?alt=media&#x26;token=c7ac367c-0ebd-46f3-b196-980ca0a4fb27" alt=""><figcaption><p>Searching customer - Aurena page calls CustomerOrderHandling.svc/Reference_CustOrdCust6 operation to check user input</p></figcaption></figure>

{% hint style="info" %}
Reference LOV entity sets may contain default filtering compared to standard projections. For example the Reference LOV entity set may not contain entities that have a certain status (blocked); not allowed to use. When reading the same entities from a  standard projection all records ,despite of status, are returned. Using Reference LOV entity sets can be beneficial since no additional LOV filtering in Flow is needed.&#x20;
{% endhint %}

#### Reference may be static or dynamic:

* Static reference means that the IFS component is mandatory related to the entityset.&#x20;
* Dynamic reference means that the IFS component is not mandatory related to the entityset.

**Static Reference LOVs**

Static reference LOVs refers to entities that originate from IFS components that are mandatory for the projection (EquipmentAllObjectsHandling). Depending on the reference entity business rule; filtering may be applied in Reference calls (company, site, organization..).&#x20;

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F6F0fLmZIlDCzNVvH8GRE%2FReference.png?alt=media&#x26;token=63c62c64-6a62-4214-ad72-0d043df29750" alt=""><figcaption><p>Reference LOVs for equipment</p></figcaption></figure>

**Dynamic Reference LOVs**

Dynamic reference LOVs can be used if the IFS component, where reference entity originates from, is installed. Example DynReference\_BankIdentifierCodeHrLov refers to entity BankIdentifierCode in component PAYLED. If PAYLED component is not installed, these LOVs cannot be used.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2Ffnds0z8RqFDxLlOpi4nZ%2FDynReference.png?alt=media&#x26;token=4f611dab-8641-41f2-816e-e5c24452270a" alt=""><figcaption></figcaption></figure>

### :tools: WIP \<EntitySet>Virtual

## Actions/Functions folder

### Unbound static actions/functions

Static actions and functions are various types of operations not linked to entity, e.g. the are **no necessarily** mandatory parameters to identity certain entity.&#x20;

*

```
<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FS9fkRtTA4lFOqmcSRVLO%2Fimage.png?alt=media&#x26;token=06074057-0663-40de-9eb9-a6d25e61645b" alt=""><figcaption><p>Static actions/function separated in folders</p></figcaption></figure>
```

* Functions are read only operations.
* Action is an operation that change data in IFS.

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FeTqmOqmawSYBcxlX09l1%2Fimage.png?alt=media&#x26;token=6a0410a7-b505-4afc-bc5b-96333cd2ca61" alt=""><figcaption><p>Action to create service quotation</p></figcaption></figure>

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2Fepb7DlazSlK1vg8GuqzH%2Fimage.png?alt=media&#x26;token=301f844a-4009-4813-bbd8-ac5914cc6705" alt=""><figcaption><p>Function to get sales part info</p></figcaption></figure>

## Code -section

Code section allow developer to create C# code to call IFS APIs. See more from [Missing operation](https://docs.novacura.com/flow-ifs-cloud-development-guidelines/flow-development-with-odata/implementation/missing-operations) and [C# usage in the OData connector](https://docs.novacura.com/flow-ifs-cloud-development-guidelines/advanced/c-usage-in-the-odata-connector).

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2F76FYwBsIPq4gL7IXisPa%2Fimage.png?alt=media&#x26;token=5e535ffd-167c-4d65-bee1-fd81f6fc7ed5" alt=""><figcaption><p>Code section</p></figcaption></figure>

## Custom Request

Custom request functionality allows developer to **configure** API call (in case of missing operation) instead of writing C# in Code section. Read more from [here](https://docs.novacura.com/flow-ifs-cloud-development-guidelines/advanced/custom-request).

<figure><img src="https://3323790987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJyIxKYxK0LMJ2T3XubCS%2Fuploads%2FXdXul5BmeTofPq6svmSx%2Fimage.png?alt=media&#x26;token=e90331ab-56b0-418b-b9d0-c8daf298b4d5" alt=""><figcaption></figcaption></figure>
