Codes
Answers
var example_array = ['Rahul','Rajesh','Sonu','Siddhi','Mark','George'];
function checkArray(value,array)
{
var status = 'Absent';
for(var i=0; i<array.length; i++)
{
var name = array[i];
if(name == value){
status = 'Present';
break;
}
}
return status;
}
//capitalize only the first letter of the string.
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
//capitalize all words of a string.
function capitalizeWords(string) {
return string.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); });
};
{
"users": [
{
"id": 0,
"name": "Adam Carter",
"work": "Unilogic",
"email": "[email protected]",
"dob": "1978",
"address": "83 Warner Street",
"city": "Boston",
"optedin": true
},
{
"id": 1,
"name": "Leanne Brier",
"work": "Connic",
"email": "[email protected]",
"dob": "1987",
"address": "9 Coleman Avenue",
"city": "Toronto",
"optedin": false
}
],
"images": [
"img0.png",
"img1.png",
"img2.png"
],
"coordinates": {
"x": 35.12,
"y": -21.49
},
"price": "$59,395"
}
createCarousel(batchId, leads)
{
const cardArr = [];
let items = [
{ "Name": 'x', "LeadId": 1 },
{ "Name": 'a', "LeadId": 2 },
{ "Name": 'b', "LeadId": 3 },
{ "Name": 'c', "LeadId": 4 },
{ "Name": 'd', "LeadId": 5 }
];
items = items.filter(item => leads.includes(item.LeadId));
for (const item of items) {
const header = {
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": item.Name
};
const actions = [
{
"type": "Action.Submit",
"title": "Qualify",
"data": { [KEYACTION]: ACTIONQUALIFYLEAD, [KEYOBJECTID]: item.LeadId, [KEYBATCHID]: batchId }
}
];
const acard = CardFactory.adaptiveCard(
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
header
],
"actions": actions
}
);
cardArr.push(acard);
}
return {
"type": "message",
"attachments": cardArr,
"attachmentLayout": AttachmentLayoutTypes.Carousel
};
}
Questions
Answers
Answer accepted
Users
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us