Question

How to determine if SharePoint document/item reference found?

  • 15 December 2020
  • 5 replies
  • 54 views

Badge +1

Hello,

I may have a very simple and maybe stupid question, but is there was a to determine as part of the K2Five for SharePoint workflow if a reference is not found? The goal is to find a document in a different library based on a certain filter criteria. I got the filtering to work correctly and find the 1 specific document need, but would like to provide a error to the user if the document needed for the workflow to complete is not found so they can investigate.

Cheers and thanks for the help.


5 replies

Userlevel 3
Badge +6

Hi @K2singh,

Im not enirely sure what your scenario is as I do not have a lot of knowledge in sharepoint, but as for the workflow part, perhaps a decision step might help/work:
 

Maybe create a variable with an error message that you can call back to where ever you need it to be
Custom rule on the decision step

 

Kind Regards

Prineel

Badge +1

 @Prineel  Well I have a step that looks up the reference document which I could duplicate in a Decision step to log the error, but I am still unsure to determine if the document/record was found. I tried to use logic such as if ID is null then document not found, however that did not work or maybe I am not putting the correct value or format for a record with no data in the ID field.

Userlevel 3
Badge +6

Hi @K2singh,

 

You can use the email step to check what data you are returing by putting the reference/variable in an email step, then sending it to yourself. 

Here I used the SmarObject get list method and set the ID = 1 , so it will return the first item in the database, you can set the ID equal to a variable or reference to get a specific record. This way, you can see what it returns

Kind Regards

Prineel

Badge +1

HI @Prineel 

I did do that, but like I said it returns a blank or null value because the reference can not be found. What I am trying to do is log a error if reference can not be found.

Userlevel 3
Badge +6

Hi @K2singh,

Im assuming that your ID is a number type, so I tried something which may help you:
 

This is how my workflow looks. The set variable step is to take the ID and convert it into a string
This is the conversion on the variable step (I used the to string function). 
This is the decision step, so if the convert to text variable is less than 1, then send an error message. If it is blank, then send an error message. However the empty string might not work, im hoping that it rerturns a “0” instead of just empty because then you can just use the <1 if statement. 

I dont think you need to convert to a string, but when i tried it, it did not work for me.

 

Kind Regards

Prineel

Reply