ideavist
Posts: 0
Joined: Fri Aug 24, 2012 11:15 pm

Status Exception and Messaging (javascript?)

I built an app using the FullContact API (XML). Max, you actually helped me wih this at HackDenver :-)

http://www.fullcontact.com/developer/...

The problem I'm having is when I'm searching for a name that doesn't exist.

Right now, the mapping is set up so that if the name exists, it's tells me how many people have that name. If, however, there is an "exception" where the "status" is 404 (meaning the name does not exist), then it displays the "message" associated with that "status".

This is all on FullContact's side.

Result of API pull...

/ exception
/ status404
/ messageUser with name abcdef not found.
/ exception

In the code above, "abcdef" is the name that was searched. The name obviously does not exist, so therefor the "message" is produced on screen on the mobile app.

If it helps, here's how the results look in JSON (which I'm not using)...
//{
"status": 404,
"message": "User with name Ssssssss not found."
//}

My questions is... How do I get the app to display a different message AND still display the name.

Example: That name "abcdef" does not exist.

I don't know any javascript :-(

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Status Exception and Messaging (javascript?)

In Data Mapping tab, where the message is mapped to Label component, click Add JavaScript, and add this:

code
return "You new message&quot
/code

Let me know if this helps.

ideavist
Posts: 0
Joined: Fri Aug 24, 2012 11:15 pm

Status Exception and Messaging (javascript?)

OMG, that totally worked! Thanks Max!

ideavist
Posts: 0
Joined: Fri Aug 24, 2012 11:15 pm

Status Exception and Messaging (javascript?)

Okay, actually that didn't work.

Now it shows that return message regardless of whether or not a valid name was entered.

I want the return message to populate ONLY if the name is not valid.

Return to “Issues”