• Ravi Narayanan
  • NEWBIE
  • 380 Points
  • Member since 2013
  • Developer

  • Chatter
    Feed
  • 11
    Best Answers
  • 2
    Likes Received
  • 4
    Likes Given
  • 18
    Questions
  • 103
    Replies
Hi Guys,

I am developing a Custom Hybrid Mobile Application like SIRI/GOOGLE NOW  for Salesforce. 

Users can open the Application. Ask questions like "what are the leads created today?/ Can you please show me the leads created today? etc etc etc ".

System can understand the question and it can respond with Salesforce leads created today.

Do you guys think this app will be useful for customers? based on the feedback , i am planning to complete this app and submit on appexchange.

Before i proceed with bigger implementation,Just want to check if any such app exist / will it be really useful?
 
Thanks,
Ravi Narayanan
Hello ,

I am trying to create a html basic sample page where i want to authenticate the users using connection.js. the below code works good inside salesforce org. but doesnt work when i use the code in a html page and try to establish connecion :( anyone have experience connecting html page to salesforce ? can someone please me ?
<apex:page standardController="case">
<script src="/soap/ajax/23.0/connection.js" type="text/javascript"></script>
<script type="Text/javascript">
sforce.connection.login("username", "pwdplustoken");
function setupPage()
{
var qry="Select Id, Name, Industry From Account";
var result=sforce.connection.query(qry,layoutResults);
}
function layoutResults(queryResult, source)
{
if (queryResult.size > 0)
{
var output = "";
var records = queryResult.getArray('records');
for (var i = 0; i < records.length; i++)
{
var account = records[i];
output += account.Id + " " + account.Name +" [Industry - " + account.Industry + "]<br>";
document.getElementById("out").innerHTML=output;
}
}
}
</script>
<apex:pageBlock >
<input type="button" Title="Get Accounts" Value="Click me" OnClick="setupPage()"/>
<div id="out">test</div>

</apex:pageBlock>
</apex:page>
Hi,

I am using a Map<Boolean, Idea> . I am trying to adding up values in the map in a for loop. But only the last added values only saved in the map. I can't able to identify it. 
 
listofIdeas = new Map<Boolean, Idea>();
        ideaList = [ SELECT Title,Body,Id,VoteScore,VoteTotal FROM Idea Order By CreatedDate desc ];
        for(Idea ids: ideaList)
        {
            ideaIds.add(ids.Id);
        }
        List<Vote> userVote = [SELECT CreatedById, ParentId FROM Vote WHERE CreatedById = :Userinfo.getUserId() AND ParentId = :ideaIds];
        System.debug('Hi' +userVote);
        for(Idea ideas : ideaList)
        {
            for(Vote votes: userVote)
            {
                if(votes.ParentId == ideas.Id)
                {    
                    isVoted = true;              
                }
                else
                {
                    notVoted = true; 
                }                
            }
            System.debug('Voted'+ ideas.Title + isVoted); 
            if(isVoted == true)
            {
                listofIdeas.put(true,ideas);
            }
            else if(notVoted == true)
            {
                listofIdeas.put(false,ideas);
            }  
        }
        System.debug('Ideas List' + listofIdeas);
I want to compare if the user already voted on particular idea. I am facing problems on comparing it and send it to VF page and based on that I should the promote and demote button.

Thanks,
Vetri
 
Hello all,

I followed the steps for creating a hybrid remote mobile app using foredroid and cordova. But once i build and run the emulator, i am getting error index.html not found.can someone pl help me with this?

Thx,
Ravi Narayanan
Hi Guys,

I am newbie in sf hybrid mobile app development. I am trying to develop a very basic hybrid_remote app. I installed forcedroid using npm. then i installed cordova using npm. 

But when i try to  create a new app using npm, i am getting the followinig error.
C:\Users\gssranar>forcedroid create
Enter your application type (native, hybrid_remote, or hybrid_local): hyb
ote
Enter your application name: hbd
Enter the target directory of your app: hbd
Enter the package name for your app (com.mycompany.my_app): com.hbd.com
Enter the start page for your app (only applicable for hybrid_remote apps
x/hbd
Creating a new cordova project.
Error: ENOENT, no such file or directory 'C:\Users\gssranar\hbd\hbd'

Can someone please help me with this?
I have VF page in which some of the records as displayed on my VF page and the View State disagree.  Not all, just some and only for a couple fields.  Is that normal or expected ? 

If not expected behavior, how do I report it or resolve it ?  I only have standard support, so I got referred back here in my attempts to report it.
 
Hi Guys,

Is it possible to retrieve records from MONGO DB and show it in salesforce using REST API?

Is it possible to insert records to Mongo db from Salesforce using REST ?

if Possible,Any Code Samples Please?

Thanks,
Ravi Narayanan
Hi All,
can any one help me by giving code for vfpage
1) should contain stndard controller and extension
2) when clicked on record it should get redirectto another page and based on id fields shoulld display in textbox in that page code should work
3) one input text and command Button
on loading page the textbox should be disable and when button is clicked it should get enabled. by using javascript.

please can any one give code for this.
 
Hi,

I have a selectlist (dropdown list) with color code, when i select one option from this colorcode list through onchange event, i am getting the below exception

System.TypeException: Invalid conversion from runtime type String to List<System.SelectOption>

please help me, thanks in advance

Thanks,
Satish
what is isrunningtest?? please explain with example???

Hi Guys,

I have an integration Class where i am having 5 future Methods.

The Requirement is to insert 50,000 records that we are receiving from another ERP.

So due to Governer Limits, i am using Future methods for seperating transaction and inserting 10,000 records in one future method.

My Question is, Suppose if soome error occurs during this Insert Operation,i want to rollBack all the records inserted from this code. 

Suppose if error occurs at 30001 record, all the previously inserted 30,000 records should be rolledback.

Please can someone help me with this.  i am not sure if i can use Savepoint as it is Future Calls and will be a separate Transaction.Its a very urgent issue.

I have some records in ACCOUNTS which needs to be SORTED by clicking its header. I have downloaded a JAVASCRIPT file and uploaded to STATIC RESOURSES for embedding it in Visualforce. I have used this tag,   /*** hello is my javascript***/
<apex:includeScript value="{!$Resource.hello}"/>
Everything goes wel but i cant able to sort by click. Is that procedure right?
If you can gimme an Example,it will be great for me :)

Thanks In Advance :)

Hello Guys,

I am using twitter bootstrap in my VF pages for making UI more professional and also using certain components to show Progress bars and all.
But i am facing issues with ShowHeader and StandardStyleSheets=TRUE attributes in Apex:Page.The Bootstrap increases the font size of the sidebards and headers and it makes the page looking enirely different from other pages 

is there anyway by which we can apply bootstrap CSS only for selective Components  in our VF pages? I want to use ShowHeader=TRUE as it is the expectation from Customer. Please help me asap ! 

Hi,

I am trying to disable one of our triggers but a test class has started throwing an error.
 
System.ListException: List index out of bounds: 0
Stack Trace: Class.tstctrlAgentCaseToAccount.testctrlAgentCaseToAccount: line 78, column 1
Here is the test class
@isTest(SeeAllData=true)
public class tstctrlAgentCaseToAccount{

    public static testMethod void testctrlAgentCaseToAccount() {
        Test.startTest();
        
        Id agentRecTypeId =  [Select Id, Name from recordtype where sObjecttype = 'Account' and name = 'Agent Organisation Record'].Id;
        
        user u = [Select Id from user where Division_Role__c = 'HE' limit 1];
        System.runAs(u) 
        {
            Test.setMock(WebServiceMock.class, new WebCADAgentPushServiceMockImpl());
            
            list<account> accountList = new list<account>();
            account acc = new account();
            acc.name='testcasetoagent';
            acc.recordtypeId=agentRecTypeId;
            acc.BillingCity = 'test';
            acc.BillingCountry = 'test';
            acc.BillingState = 'test';
            acc.BillingStreet = 'test';
            acc.BillingPostalCode = '43213';
            acc.Fax = '4321234';
            acc.Name = 'xdfg';
            acc.AKA_Name__c = 'test';
            acc.Phone = '4534534';
            acc.Website = 'test.com';
            accountList.add(acc);
            insert accountList;
            
            Case c = new Case();
            c.Status = 'test';
            c.Company_Name__c = 'xdfg';
            c.Billing_Street_Address__c = 'test1';
            c.BillingCity__c = 'test1';
            c.Billing_State__c = 'test1';
            c.Billing_Postcode__c = 'test1';
            c.Billing_Country__c = 'test';
            c.Fax__c = '34523134';
            c.Phone__c = '523452345';
            c.Website__c = 'test1';
            c.Business_Registration_Number__c = '654356';
            c.Start_Year_Agent__c = '2013';
            c.No_of_Counsellors__c = '2';
            c.Title_Corr__c = 'test1';
            c.First_Name__c = 'test1';
            c.Family_Name__c = 'test1';
            c.Position_job_title__c = 'test1';
            c.Direct_telephone__c = '768578565';
            c.Email__c = 'test1@test.com';
            c.Mobile__c = '8765467';
            c.Title_Add__c = 'test2';
            c.First_Name_Add__c = 'test2';
            c.Family_Name_Add__c = 'test2';
            c.Position_job_title_Add__c = 'test2';
            c.Direct_telephone_Add__c = '13563473';
            c.Email_Add__c = 'test2@test.com';
            c.Mobile_Add__c = '888876555';
            c.Bank_Name__c = 'test';
            c.Bank_Account_Name__c = 'test';
            c.Bank_Account_Number__c = 'test';
            c.Bank_Sort_Code__c = 'test';
            c.Bank_Address_1__c = 'test';
            c.Bank_Address_2__c = 'test';
            c.Bank_City__c = 'test';
            c.Bank_Postal_Code__c = 'test';
            c.Bank_Country__c = 'test';
            insert c;
            
            
            //Maintain Portfolio page
            PageReference pageRef = Page.casetoaccount;
            Test.setCurrentPage(pageRef);
            ApexPages.currentPage().getParameters().put('caseid', c.Id);
            ctrlAgentCaseToAccount controller = new ctrlAgentCaseToAccount(); 
            //Select matching account
            List<ctrlAgentCaseToAccount.accountWrapper> tempAccSearchList = controller.getsimilarAccounts();
            tempAccSearchList[0].selected = true;
            controller.setsimilarAccounts(tempAccSearchList);
            pageRef = controller.createNew();
            pageRef = controller.mergeAccounts();
            List<ctrlAgentCaseToAccount.mergeWrapper> tempMergeList = controller.getmergeList();
            for(ctrlAgentCaseToAccount.mergeWrapper mw: tempMergeList)
                mw.overrideExisting = true;
            controller.setmergeList(tempMergeList);
            pageRef = controller.finalMerge();
            pageRef = controller.cancel();
            
            
        }
        Test.stopTest();
    }
}

Any suggestions?

Thanks,
Michael

 
Does anybody has a working example that uses the connection.login.js ?

I'm trying to connect to salesforce from an exterior website using javascript and getting an Error.

Here is My code:

<!DOCTYPE HTML>
<HTML>
<HEAD>

<script src="https://na6.salesforce.com/soap/ajax/30.0/connection.js" ></script>

<script type="text/javascript" >

function logincall()
{

    try{
   
   
    var usrname = document.getElementById('userid').value;
    var passwrd = document.getElementById('passid').value;

    if(usrname == null || usrname == '' || passwrd == null || passwrd == '')
    {
        alert('Please enter Username AND Password');
        return;
    }
   
    var result = sforce.connection.login(usrname, passwrd);

    alert("Logged in with session id " + result.sessionId);
    }
    catch(error)
    {
        alert(error);
       
       
    }

}
</script>

</HEAD>

<BODY>

To test logging into a Salesforce Instance using the connection.js "login" call

<table>
        <tr>
            <td>Username</td>
            <td><input type="text" id="userid" value="" /></td>
        </tr>
        <tr>
            <td>Password</td>
            <td><input type="password" id="passid" value="" /></td>
        </tr>

</table>

    <input type="button" value="Login" onclick="logincall();" />

</BODY>

</HTML>


I'm getting an Error :  The requested url services/Soap/u/30.0 was not found on this server


Any idea anyone?

Hi,

 

How to create custom object and custom object fields using Apex code.

 

Is this possible?

 

Thanks,

Yarram.

I have developed HTML5 app which is working just fine in browser.

 

Now I'm looking for Hybrid Remote app (android & iOS). I created connected app to SF, URL is pointing to my HTML5 app. Hybrid remote client starts fine, shows login and then goes fine to my app. Working perfectly to this stage.

 

But then, my app have logout button which redirects to /secur/logout.jsp, with browser this works as expected. With hybrid app, it logouts and shows the login screen again but if I now try login again, it opens to SF home page and not my HTML5 what I expected. Also, if I restart hybrid app, it goes straight to HTML5 app so looks like the hybrid app did not logout.

 

How I should implement the logout so it will logout the hybrid client. Can I somehow listen URL where hybrid app webview is going ?