Question

How to connect Employee to Resource/Person via REST

  • 6 April 2022
  • 2 replies
  • 140 views

Userlevel 2
Badge +4

In IFS 10.14 we try to connect an Employee to a Resource / Person record via a REST call to ResourceDetailsHandling.svc/ResourceSet(ResourceSeq=<resourceSeq>)/ResourceConnectionEmployeeArray,

According to the API documentation the field ResourceConnectionSeq is required in the payload.
The problem is that that value should be created by this API, and does not exist until the call has been completed.

In IEE RESOURCE_CONNECTION_API the function Get_Next_Sequence___ appears to handle the increment of the sequence number. 
However, offering an empty value to the payload (assuming IFS will create one) results in an error. Offering a numeric value creates the record with that passed numeric value as ResourceConnectionSeq, but of course carries the risk of duplicates. 

The documentation does not give any clarity

Any help would be appreciated.

Regards, Reinier


2 replies

Userlevel 7
Badge +11

Hi @ReinierHulsman ,

The reason for this the scope of the method/function Get_Next_Sequence___. This method has 3 underscores(___) in the end of it's name. This means that this method is 'Implementation' in the IFS Scope and 'Private' in PL/SQL scope

his means that this method can be used within it's own API package RESOURCE_CONNECTION_API. If you look carefully in the API, you can see how it's used

 newsiterec_.resource_connection_seq := Get_Next_Sequence___;

Also this function is not exposed to outside in the package specification. 

So, using this method outside of the API like RESOURCE_CONNECTION_API.Get_Next_Sequence___ is not going to work.

Additionally, if you really need to use this method, I'd suggest you to use a custom method in Public scope within the API and use it inside that custom method.

FUNCTION Custom_Method RETURN NUMBER
IS
    seq_  NUMBER;
BEGIN
    seq_ := Get_Next_Sequence___;
    RETURN seq_ ;=
END Custom_Method;

Hope this answers your question. 

Best Regards,
Charana

Userlevel 2
Badge +4

Hi @Charana Udugama 

Thanks for your quick reply.
I was aware that this private function cannot be used frou outside the package.
The question than remains: why is this REST api (used for adding a new record) requiring a value it should internally create?  

Well, my first try was to do it without any configuration, but I'm afraid I have to go to the custom method option you mention. 

So thanks for your suggestion!

Regards, Reinier

 

Reply