-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
9Questions
-
4Replies
How do i go about parsing this json
"name": "testparser",
"org": "test",
"email": "rpl@gmail.com",
"courses": [
{
"cname": "this is course1",
"startdate": "2014-04-12"
},
{
"cname": "this is course2",
"startdate": "2014-04-13"
}
]
}
- rpl
- March 26, 2014
- Like
- 0
- Continue reading or reply
Please help me parse this json. I am getting an error: unexpected parameter Os
@RestResource(urlMapping='/NewIncident/*')
global without sharing class WSIncident {
@HttpPost
global static String createMobileCase(string example) {
contact newCase = new contact();
JSONParser jParser = JSON.createParser(example);
/*CAN SOME ONE PLEASE HELP ME PARSE THIS JSON*/
return newCase.Id;
}
}
- rpl
- January 17, 2014
- Like
- 0
- Continue reading or reply
Integration of salesforce data with external application
but when it comes to mobile application we had to change the design such that it shows a list of PRODUCT TYPE values on the screen. when user selects one of the type, he is taken to the next screen where he can enter further information.
CAN SOMEONE PLEASE ADVICE ME ON HOW TO GO ABOUT THIS?
- rpl
- January 16, 2014
- Like
- 0
- Continue reading or reply
JSON Parser: Need help in understanding it
@RestResource(urlMapping='/NewIncident/*')
global without sharing class WSIncident {
@HttpPost
global static String createMobileCase(string example) {
contact newCase = new contact();
JSONParser jParser = JSON.createParser(example);
/*CAN SOME ONE PLEASE HELP ME PARSE THIS JSON*/
return newCase.Id;
}
}
- rpl
- January 16, 2014
- Like
- 0
- Continue reading or reply
@httppost
global without sharing class WSContact {
@HttpPost
global static String createMobileCon(string input) {
// string input='{"input":{"LastName":"TEST","Designation":"TESTER"}}';
/*
i am unable to parse the json input when it comes in as a parameter
*/
insert newCase;
return newCase.id;
}
Any help will be highly appreciated.
- rpl
- January 16, 2014
- Like
- 1
- Continue reading or reply
SalesForce SDK for Android: is there a way to by-pass the OAuth?
Can some one suggest me how to go about it??
Your help will be much appriciated.
- rpl
- December 23, 2013
- Like
- 0
- Continue reading or reply
creating REST web service: error 404
Need direction : to create a web service that will return the list of products from salesforce and then use this service as a public service in an iOS app.
Below is a dummy rest service i wrote just to test if salesforce returns data when a request is made. But it throws a 404 error.
@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource
{
@HttpGet
global static Account doGet()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
//String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
try
{
Account result = [SELECT Id, Name, Phone, Website FROM Account limit 1];
return result;
}
catch (exception e)
{
return null;
}
}
}
i am a fresher andd very new to web services. making a web service in salesforce with OAuth involved is becoming very confusing for me.
Any help would be highly appreciated.
Thanks!
- rpl
- October 23, 2013
- Like
- 0
- Continue reading or reply
iOS app integration with salesforce
I have a task to integrate an iOS app with salesforce such that anybody(may or may not be a salesforce user) who uses the application can see the Product list in the application.
This product list is supposed to be imported in the app through salesforce.
I am very new to salesforce as well as web services.
Can some one please direct me towards a step wise way of achieving this...?
- rpl
- October 23, 2013
- Like
- 0
- Continue reading or reply
Test class for a Class used only for the customer portal users
below is my class and the related test class that i have created for it.
if i run the code without using System.runas(test_portal_user) it gives me 61% coverage. i am trying to increase the coverage and so i created a test account for a test user and run the code as the test_portal_user.
public class Scp_Portal_Tab_Controller
{
public integer offsetValue = 0;
public integer LimitValue = 10;
public integer recordCount =0;
public boolean PortalUser{set; get;}
Service_Credit_Program__c SCP=new Service_Credit_Program__c ();
list<Service_Credit_Program__c> recList=new list<Service_Credit_Program__c>();
User U=[select id,name,Email,Phone,city,PostalCode,Street,state,CompanyName,AccountId,IsPortalEnabled from User where id=:userinfo.getuserid()];
public Scp_Portal_Tab_Controller()
{
if(u.AccountId!=null)
{
account a =[select id, Name, Phone, billingStreet, billingCity, billingPostalCode, Total_SCP_Credits_del__c, Total_Man_Days__c from account where id=:U.AccountId];
/* SCP.address__C=a.billingcity;
SCP.Telephone__c=A.Phone;
SCP.Accounts__c= a.id;
SCP.ZIP_Code_P_O_Box__c=A.billingPostalCode;
SCP.City__c=A.billingStreet; */
SCP.Name__c= a.name;
SCP.Total_Credits__c= a.Total_SCP_Credits_del__c;
SCP.Total_Man_Days__c= a.Total_Man_Days__c;
recordcount = [select count() from Service_Credit_Program__c where Accounts__c=:u.AccountId ];
if(U.isPortalEnabled==true)
{
if(recordcount==0)
{
PortalUser=false;
ApexPages.Message error= new ApexPages.message(ApexPages.severity.info,'There are no Service Credit Program Requests Made');
ApexPages.addMessage(error);
}
else
{
PortalUser=true;
}
}
}
else
{
portaluser=false;
apexpages.message err= new ApexPages.message(apexpages.severity.warning,'Access Service Credit Program from the respective Account of the Requester');
apexpages.addmessage(err);
}
}
public Service_Credit_Program__c getSCP()
{
return SCP;
}
public list<Service_Credit_Program__c> getrecList()
{
recList=[select id,name,Accounts__c,Credits__c,Man_Days__c,Service_Items__c,SCP_Type__c,Status__c,Created_Date__c from Service_Credit_Program__c where accounts__c=:U.accountid ORDER BY Created_Date__c DESC limit:limitValue offset:offsetValue];
return (recList);
}
public pagereference next()
{
offsetValue += limitValue;
return null;
}
public pagereference previous()
{
offsetvalue -= limitvalue;
return null;
}
public boolean getisPreviousDisabled()
{
if(offsetvalue == 0)
return true;
else
return false;
}
public boolean getisNextDisabled()
{
if(offsetvalue + limitvalue >= recordCount)
return true;
else
return false;
}
}
below is the related test class with 21% coverage.
Error: System.QueryException: List has no rows for assignment to SObject
and
Stack Trace:
Class.Scp_Portal_Tab_Controller.<init>: line 15, column 1
Class.Scp_Portal_Tab_Controller_TC.Scp_Portal_Tab_Controller: line 14, column 1
@isTest
public class Scp_Portal_Tab_Controller_TC
{
static testMethod void Scp_Portal_Tab_Controller()
{
Profile p = [Select Id from Profile where name = 'NE Customer Profile'];
user testUser=new user();
testUser=[select id from user where isPortalEnabled=:true and profileid=:p.id limit 1];
account testAcc=new account(name='I_am_tester1',ownerid=testUser.id,billingcity='tester_city',Phone='123test789',Total_SCP_Credits_del__c=111,billingPostalCode='321',billingStreet='tester_street',Total_Man_Days__c=121);
insert(testAcc);
system.runas(testUser)
{
Scp_Portal_Tab_Controller scp1= new Scp_Portal_Tab_Controller();
Service_Credit_Program__c testSCP=new Service_Credit_Program__c(accounts__c=testAcc.id,man_days__c=5);
insert(testSCP);
testSCP.Name__c= testAcc.name;
testSCP.Total_Credits__c= testAcc.Total_SCP_Credits_del__c;
testSCP.Total_Man_Days__c= testAcc.Total_Man_Days__c;
}
Scp_Portal_Tab_Controller scp= new Scp_Portal_Tab_Controller();
scp.getSCP();
scp.getrecList();
scp.next();
scp.previous();
scp.getisPreviousDisabled();
scp.getisNextDisabled();
}
}
Please help me resolve this issue. Thanks!
- rpl
- October 09, 2013
- Like
- 0
- Continue reading or reply
@httppost
global without sharing class WSContact {
@HttpPost
global static String createMobileCon(string input) {
// string input='{"input":{"LastName":"TEST","Designation":"TESTER"}}';
/*
i am unable to parse the json input when it comes in as a parameter
*/
insert newCase;
return newCase.id;
}
Any help will be highly appreciated.
- rpl
- January 16, 2014
- Like
- 1
- Continue reading or reply
How do i go about parsing this json
"name": "testparser",
"org": "test",
"email": "rpl@gmail.com",
"courses": [
{
"cname": "this is course1",
"startdate": "2014-04-12"
},
{
"cname": "this is course2",
"startdate": "2014-04-13"
}
]
}
- rpl
- March 26, 2014
- Like
- 0
- Continue reading or reply
Integration of salesforce data with external application
but when it comes to mobile application we had to change the design such that it shows a list of PRODUCT TYPE values on the screen. when user selects one of the type, he is taken to the next screen where he can enter further information.
CAN SOMEONE PLEASE ADVICE ME ON HOW TO GO ABOUT THIS?
- rpl
- January 16, 2014
- Like
- 0
- Continue reading or reply
JSON Parser: Need help in understanding it
@RestResource(urlMapping='/NewIncident/*')
global without sharing class WSIncident {
@HttpPost
global static String createMobileCase(string example) {
contact newCase = new contact();
JSONParser jParser = JSON.createParser(example);
/*CAN SOME ONE PLEASE HELP ME PARSE THIS JSON*/
return newCase.Id;
}
}
- rpl
- January 16, 2014
- Like
- 0
- Continue reading or reply
Salesforce Integration
Hi,
I am able to integrate my web based test app with Salesforce.com using REST API. I am able to do the diferent operations from my test application via SF login. However, is there any options for me to connect to my test application from the Salesforce login account.
Any suggestion would be helpful.
Regards
Kalyani
- kalchakr
- September 20, 2013
- Like
- 0
- Continue reading or reply