Abu Ali
Posts: 0
Joined: Mon Apr 07, 2014 8:50 am

Mapping request params from list item

hi,
on the btnLike i am invoking a service with the following mapping

Image

mobilelistitem_43 is mapped already in other service to show an array of facebook feed and it works fine
and this is the mapping

Image

my problem that the request param "object-id" is always takes the first item in the results array.

what did i miss ?

thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Mapping request params from list item

Hi Abu,

This is because you cannot map an array of UI components as request parameters. To do this add a service GetEventFeeds Success event handler:prevar arr = [];
$(data).each(function(){
arr.push(this.id);
});
localStorage.setItem("arr", JSON.stringify(arr));/preThis saves an array of IDs to a localStorage variable 'arr'.

Then in service LikeAPost add the following JS code to a parameter 'object-id':prereturn localStorage.getItem("arr");/pre
Finally, you'll have a mapping of array of IDs to a parameter 'object-id'.

Abu Ali
Posts: 0
Joined: Mon Apr 07, 2014 8:50 am

Mapping request params from list item

thanks for your reply, but i want to map only the corresponding id to the listitem containing the btn not the whole array

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Mapping request params from list item

Hi Abu,

Run this code on button Click event:prevar text =
$(this).parents()find("[name=labelName]").text();
localStorage.setItem("text", text);/pre
And then run the following JS on request parameter 'object-id' mapping:prereturn localStorage.getItem("text");/preWhere 'labelName' is a name of the label where you store ID.

Abu Ali
Posts: 0
Joined: Mon Apr 07, 2014 8:50 am

Mapping request params from list item

it is not handling my input control on btn event

this line return "" always
var text =$(this).parents().find("[name=txtPostID]").text();

can you check it plz? my account is a href="mailto:ana.wzghir@gmail.com" rel="nofollow"ana.wzghir@gmail.com/a

thanks

Abu Ali
Posts: 0
Joined: Mon Apr 07, 2014 8:50 am

Mapping request params from list item

it works by applying this on btn click event

var text =
$(this).parent().find("[name=txtPostID]")[0].value;
localStorage.setItem("postid", text);

thanks

Return to “Issues”