I know this sounds confusing but an activity outputs an object and I want to pass the value of this object into another object for it to be outputted to the system.
In order for me to test that the output that the activity give is correct. I used object.tostring and value is correct. I then did object = object + “blah” + “blah”. But it did not output anything. I also tried adding object.tostring to it and it gives me the error object cannot use + operator. I also get the error object is not set to reference of an object.
What is the variable type of this “object”?
Did the object.toString + "blah" +"blah" gave you errors?
It also looks like the object might not be initialized, before you are using it. Where exactly does it come from?
@bobby
Try logging just department.ToString and see what that gives you. As @SSavickas mentioned if you’re getting an Object reference not set to an instance of an object. error it means that nothing was returned from the activity so your department object has no value at the point where you are trying to log it. In that case you’ll want to do a null check which you can do by using department is nothing inside an If statement.
@bobby
When you’re trying department.ToString or "sometext" + department.ToString are you doing it from the variable panel like you are in this picture that you shared?
If so it will always fail with the “Object reference not set to an instance of an object.” because the bot initializes that variable when it starts, so department will never have any value there.
Yes, I am doing through the variable panel. Ok that makes sense. Should I do it as an assign? But I tried doing in an assign String dep = department.tostring and then passed in dep into the newDescription and it still didnt work.
@bobby
Yes, you should be able use an Assign to do this. Create the variable, make sure it’s type is String and then try myVar = department.ToString + "some string" I would also recommend putting a Log Message after that to log the value of myVar and make sure it is what you’d expect.