• 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,

I am having a followng apex code which is reutrning the following error

"List has more than 1 rows assignment to S object"


VF PAGE :

<apex:page standardController="AccountExceptions__c" extensions="AF_ExecutiveReportController">
    <apex:form >
     <style>
        .headerRow .TableTitle {
            color: #CC0000 !important; 
        }
    </style>
        
        <apex:pageBlock title="Executive Committee Report" >
            <b>  <apex:outputText value="1.Total Exceptions ($50,000 threshold per Region):" style="Color:purple" /></b>
            <apex:pageBlockTable value="{!accexp}" var="item" rendered="{!accexp.Type__c=='Exception Adjustment' || accexp.Type__c=='Business Relationship Adjustment'}">
               <b> <apex:column headerValue="Region" headerClass="TableTitle"/> </b>
               <b> <apex:column  headerValue="TotalExceptions" Value="{!accexp.Total_Amount_of_Current_Exception__c }" headerClass="TableTitle"/> </b>
            </apex:pageBlockTable> 
        </apex:pageBlock>
    </apex:form>
</apex:page>


MY CONTROLLER :


public class AF_ExecutiveReportController {
public AccountExceptions__c accexp{get; set; }



  /**
    ** Constructor
    **/
   public AF_ExecutiveReportController (ApexPages.StandardController controller) {
   
   accexp= [Select Id,Account__c,ADR_Month__c,DOSUser__c,Total_Amount_of_Current_Exception__c FROM AccountExceptions__c WHERE ADR_Month__c!=null  ];
   
   }


}

i want to display alll the values for the field i called in my vf page


Help me what do i need to change in my code

Thanks in Advance
Hi,

I need help to write a validation rule for the following requirement


1) I am having a custom lookup field called as DOSApprover_c in my custom object called as "AccountExceptions__c"

2) There is another custom lookup field with account called as "Account__c" in the same custom object


when i select the account and if the account record type is "Group account" only then the field DOSApprover__c should be set mandatory 


Help me how to achieve this req validation rule


Thanks in Advance
Hi,

I am having a following requirement for which i have written a trigger which i need help on it


1) I am having a field called as DOS Approver__c which is a lookup to user object

2) I am having another field called as RVP Approver__c which is a look up to user object

3) I am having a custom field called as New Request__c which is a lookup to account  


All these 3 custom fields are present in my custom object called as "Account Exceptions"(Special_Programs_ADR_Exception__c)


My req is when i select a account(New Request__c ) and a DOS Approver__c the RVP Approver__c should be auto populated with the manager of the DOS APPROVER User 

This functionality should be applied only for Group Account record type(Based on the account that i select in my custom object)


MY TRIGGER :


trigger AF_RVP on Special_Programs_ADR_Exception__c (after insert, after update) {
List<Id> rvpId = new List<Id>();
Set<Id> adrId = new Set<Id>();
    for(Special_Programs_ADR_Exception__c spl:trigger.new)
    {
           rvpId.add(spl.DOSUser__c);
           rvpId.add(spl.NewRequest__c);
  adrId.add(spl.Id);
    }
  
   
RecordType  rtypes = [SELECT Name, id FROM RecordType WHERE isActive=true AND SobjectType='Account'AND Name = 'Group Account' limit 1];

User actingUsers =[SELECT Name, ManagerID, Manager.Name, Manager.ManagerID, Manager.Manager.Name FROM User WHERE Id = :rvpId LIMIT 1];

List<Special_Programs_ADR_Exception__c> adrExpList = [Select Id,RVP_Approver__c,NewRequest__c,NewRequest__r.RecordTypeId From Special_Programs_ADR_Exception__c Where Id IN :adrId];
 
List<Special_Programs_ADR_Exception__c> oppts = new List<Special_Programs_ADR_Exception__c>();
for (Special_Programs_ADR_Exception__c obj : adrExpList)
{
if(obj.NewRequest__r.RecordTypeId = rtypes.Id) {
obj.RVP_Approver__c=  actingUsers[0].ManagerID;
}   
}
}

I am getting the following error


Error: Compile Error: Expression must be a list type: SOBJECT:User at line 20 column 23

obj.RVP_Approver__c=  actingUsers[0].ManagerID;


Kindly help me what do i need to change in my trigger

Thanks in Advance
Hi,
I am using datable to show data int able formate in vf page . If it showing 10 records
My requirement is when i click the button the corresponding recod should be  in editable mode in same vf page .



Can any one help me out for this.....


Thanks,
sarvesh

Hi,

I need help to write a valdiation rule for following requirement


1) i am having a picklist field called as "Type__c" if the value of type is set to "Other Adjustment"  then i am having other 2 picklist fields like "Month__c" and "Year__c" should be mandatory


IF(
AND(
NOT(
ISPICKVAL(Type__c, 'Other Adjustment')),ISBLANK( ADR_Move_From_Month__c),ISBLANK( ADR_Move_From_Year__c)), true, false)


Not sure what should i replace with "Isblank" since its a picklist value

Thanks in Advance

 

Hi All,

I want to write trigger to count number of leads associated with account.Can anyone help me?

I created two fields as Parentlookup__c (lookup field) in lead object  and rollupcounter__c in account.

I wrote this trigger on lead object.

trigger leadcont on Lead (after insert) {
    Integer leadcnt ;
List<Account> ActData = new List<Account>();
//Account[] ActData = new Account[]{};

for (Lead ld:trigger.new)
{
if (ld.parentlookup__c <> null)
{
for(Account Act : [SELECT Id,rollupcounter__c FROM Account WHERE Id = : ld.parentlookup__c])
{
  leadcnt = integer.ValueOf(Act.rollupcounter__c)+1;
  ActData.add(new Account(Id=ld.parentlookup__c, rollupcounter__c=leadcnt));   
}
}
}
if (!ActData.isempty())
{
    update ActData;
}


}

I am getting an error "Invalid constructor syntax,name=value pairs only valid for Sobjects".

Kindly support and suggest.
Hi Everyone,
      Can anyone tell me what is trigger.new, trigger.old and trigger.newmap ,trigger.oldmap
Trigger.oldmap.keyset with sample example


Thanks in advance
Karthick

Hi,

We have a vf page form that has an inputfile tag for uploading image, along with that on the form we have a commandlink that call a javascript method that calles the controller save method and onComplete of this we call a controller method that does a webservice callout. 

So when i click on the command link i get a error saving apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

after reading certain posts i tried putting the commandlink and actionFunctions in actionRegion tag.. and now the above error has gone, but I get a new error saying "You have uncommitted work pending. Please commit or rollback before calling out" 

below is my vf code snippet
<apex:page>
 <apex:form>
<label>Profile Picture (Dimensions 324 x 219 pixels)<span>*</span></label>
<apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
<apex:commandLink styleClass="social" onclick="SaveRecord_JS();return false;"/>
<apex:actionFunction action="{!save}" name="SaveRecord_JS" oncomplete="CallWebService_JS();"/> 
<apex:actionFunction action="{!authorize}" name="CallWebService_JS"/>
</apex:form>
</apex:page>

if i used above code i get 'apex:inputFile can not be used in conjunction..' error 
and if i put commant link and actionfunction under  <apex:actionregion> tag.. i get callout exception.

Any idea how to overcome this both errors?

Regards,
Bhushan 

how do i Trigger on account (update)
if SLA__c  (which is a custom field in account , is  a picklist )  ....when its value is =' gold '
then
-count the number of phone numbers (in phone field )  in contacts (standard object )  and populate the total count of phone number (like 1,2 or 3) in count__c (custom object ) in account.

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 Guys,

i tried to create a hybrid remote app with sf mobile sdk and cordova using forcedroid npm package.
But when i try to build the app and run in emulator using cordova emulate android, the application is not opening and i am getting an error 

"Unfortunately app has been stopped" .
Can someone please help me with this? 

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>
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?
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 Guys,

I have a requirement where the user click on a button and then a Pop should open which displays the related records.

So basically i am using Output Panel for showing this Pop . As soon as user click the command Link, it calls a method in my Apex Classs and a query will return some values and i am displaying those results in the Pop up OutputPanel.

But the above process takes more time for opening the Popup as well closing the window.

Is there any other way by which we can achieve the above functionality ? For Example using angular js something like that ....

Please help . thanks ! 

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.

Hi Guys,

I have a requirement where i have to create almost 50 fields. I came to know that it is possible using MetaData API and tried to create and it is working fine. But the code i got from gitHub is very big and its almost impossible to edit it as the browser hangs whenver i open the class.

Recently i came to know that it is Possible to create fields using TOOLING APII read the documentation given by Salesforce.com.when i try to create a instance of Apexclass , it is working fine (Apexclass a=new ApexClass();).

But the same logic is not working for customFields. Is there any other way that we should follow for creation of CustomFields?

CustomField c=new CustomField(); --- THIS DOES NOT WORK ! ! Seems there is no such table named CustomField.

Please help

Hi Guys,

We have a requirement. can someone please help us .

There is a  Custom object with name "xxxxxx__c".  so whenever a new record is being created users will attach certain number of documents(say 2/3). Approximately per month itself around 3000 records will be created.  So due to space constraints i dont think it is possible to store all the 3000 records with their respective attachments in Salesforce ORG .

So is there anyway by which we can store all the related documents in some other 3rd party server and retrieve whenever the users would like to view the attachments ? 

Its very urgent and someone please help me ! ! 

 

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 Guys,

I was going thru some of the materials for Angular JS and find it very helpful in implementing some functionalities like Filter, table sorting etc.  But is it possible to develop a complete SPA App in Salesforce ? 

Can someone give more information on what are the functionalities that can be acheived using Angular JS in VF pages? 

 

 

Hi Guys,

I have been working as a Salesforce Dev for 3 years in Administration,Apex, Visualforce,Javascript,CSS.

Now i wish to move to mobile app development in Salesforce. But i dont have any idea on how to get Started. 

I was working on a OMS Portal all these days.   Suppose i want to develop a similar OMS app in mobile where Customers can order  , how to get started?

Can someone provide me the link/pdf materials that will help us in starting with basics ? 

Thanks in Advance ! ! 

Hi,

i have a visualforce page and i am using Apex:InputFile  for uploading Image file(this image file will be stored in notes and attachments under a custom object record)   .

i have a pageblock table where the user can manualy add records . once the user click submit button, the image file name will be stored in a particular field for all these records.

Now i want to upload Multiple Images  and relate each image name with their respective records in the table.

Can someone help me with this scenario? ?  as far as i know apex:inputfile allows uploading of only one file and multiple files at a time is not possible.

 

Table:

111---------image1
144--------image1 
222-----------------image2
333-------------image3


 

Hi All,

I have a Visualforce page and i am rerendering a output panel onchange event of inputfield usng action function.

it works fine within SF APP .(/apex/pagename).

But if i do the same operation in a Force.com Site, it is not working. The Action Status is displaying both the start and stop text. but i am not getting the desired output.

this looks very strange.

can some1 pl help me.. ? its v urgent .. 

Hi Guys,

              <td>  <apex:inputfield value="{!variantAlist[0].arq_QuantityofMonth6__c}"/>   </td>
           <td>     <apex:inputfield value="{!variantBlist[0].arq_QuantityofMonth6__c}"/> </td >

now i want another column where i want to display the total of these two records. 

so i created one list in my controller and calculated sum  using totalist[0]=variantAlist[0].arq_QuantityofMonth6__c+variantblist[0].arq_QuantityofMonth6__c

So finaly my code is liek this

<td>  <apex:inputfield value="{!variantAlist[0].arq_QuantityofMonth6__c}"/>   </td>
           <td>     <apex:inputfield value="{!variantBlist[0].arq_QuantityofMonth6__c}"/> </td >
<td> <apex:outputtext value= "{!totallist[0]}"  </td> 

Everything is woking fine. 

 

But now whenever the user changes the value manually in the table,  immediately this totallist should be modified accordingly.. 

 

i thought of using onchange event in inputfield and call actionfunction and rerender. but it doesn seem to work as i already have apex:inputfile in my page and it doesn allow me to go for action tags.

 

can someone pplease help me out on this? its very urgent and i need to fix it 

 

Hi Guys,

 

i face a problem with command link.

 

When i click the command link first time, it is not calling the action method. the page is getting refreshed . 

 

But if i click the same command link once again , it is calling the action method and in turn opens  another visualforce page correctly .  This seems very wierd.   

 

Can someone please help me with this ?  

 

Infact first time when i click , the values are not even passing to the controller with <apex:param> 

 

 

Hi Guys,

 

I have a scenario. Please someone help me ! 

I want a CUSTOM Created Date Time  Field in CASE OBJECT. 

This Field should have values based on Working Hours . 

Monday to Thursday - 8 AM to 4 PM 

Friday - 8 AM to 3 PM 

SATURDAY and SUNDAY - HOLIDAY 


FOR EXAMPLE :Case created by 4:01 PM on Monday, the value of Custom Created date field should be TUESDAY 8 AM .
If a Case is created by 3:01 PM on friDAY, the value of Custom field should be MONDAY 8 AM . 

Please help me with this scenario  !  



Hello Guys,

i tried to create a hybrid remote app with sf mobile sdk and cordova using forcedroid npm package.
But when i try to build the app and run in emulator using cordova emulate android, the application is not opening and i am getting an error 

"Unfortunately app has been stopped" .
Can someone please help me with this? 

Hi All,

I have a Visualforce page and i am rerendering a output panel onchange event of inputfield usng action function.

it works fine within SF APP .(/apex/pagename).

But if i do the same operation in a Force.com Site, it is not working. The Action Status is displaying both the start and stop text. but i am not getting the desired output.

this looks very strange.

can some1 pl help me.. ? its v urgent .. 
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???
  • December 31, 2015
  • Like
  • 0

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.

  • December 11, 2013
  • Like
  • 0

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 ?

 

  • September 18, 2013
  • Like
  • 0

Hi Guys,

Recently i gone thru various blogs about Telerick's new platform NativeScript for building Native Mobile applications using Pure JS. There is also a new tool named FUSETOOLS which is also aimed at creating native mobile application using JS.

I personally feel the above mentioned tools will definitely improve perfomance of mob applications when compared with phonegap as there are no DOM involved in nativescript/fuse tools.

Does anyone know how to conenct to Salesforce with these tools?  Are there any working examples? Please help ! ! 

Thanks,

Ravi Narayanan

Hi Everyone,
      Can anyone tell me what is trigger.new, trigger.old and trigger.newmap ,trigger.oldmap
Trigger.oldmap.keyset with sample example


Thanks in advance
Karthick

I have a visualforce page in which I reterieve record after search in a pageblock table. I have a button which exports a CSV file for those records. For those CSV records I have written a visualforce page whose content type I have set to CSV. After export CSV file I want to reload the page.