• riffindus
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 48
    Replies
Hi,

I have a VF page, which displays a list of record, each record has a link to edit and they can edit and come back to the list page.

But i want to display the changes made on these list of records, who is making the change, a simple log information kind at the bottom.

even if i go for history, it cannot capture for list of records and display on single VF page.

Please help.


Hi,

I am writing a update trigger, when the opportunity is updated, captured program__r.name to Progcon.name. but it is not capturing the name.

since i use trigger.new, there is no SOQL to add the lookup object field in SOQL.

can anyone give me some suggestion to it.

when i do Opp.Program__C , it copies the Id of the record but i want name of the record.


Hi,

I have created Facebook as authentication provider and the authentication works and take the user to standard login page.

i would like to take the customer portal to force.com site page.

i am referring this help page to add parameters in the URL but when i did and try to call the SSO URL it give me a error as Bad_id

https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_provider_addl_params_site.htm&language=en_US#sso_provider_addl_params_site.xml

the error message i get is below

https://cs8.salesforce.com/_nc_external/identity/sso/ui/AuthorizationError?ErrorCode=Bad_Id
Hi,

We have customer portal, where user sign up and uses the portal. in some case, when the user closes the window and try to access customer portal in the same browser, it is loading only the VF template but not the page. The session of the user is not timed out and it behaves this way, if the user session timeout(it is 30 minutes), then the user is able to login successfull. else after login it loads only the template.

i tried adding a javascript and do the login and a page reference to go back to the last left page but it is not happening.

did anyone faced this issue?


Hi All,

in my APEX code, i pull the owner id and owner active status. if i check the status with system.debug, it shows as False (where the owner is active). if i copy paste the same SOQL and check in developer console -> query editor, i am getting status as TRUE.

I don't know, how to handle this. can someone please point me where am missing?

Below is the APEX code,

userPersonAccount = [
                select
                Id,
                FirstName,
                LastName,
                Middle_Name__pc,
                OwnerId,
                Owner.IsActive,
                PersonEmail,
                (select
                    Id,
                    StageName,
                    Opportunity_Status__c,
                    isClosed,
                    Application_Step__c
                    From Account.Opportunities
                    Where StageName  = 'Application'
                )
                from Account where Id =: currentUser.get(0).AccountId];
            System.debug('\nAcocunt : '+ userPersonAccount);
            system.debug('owner active?'+userPersonAccount.Owner.IsActive);

Hi,

 

I have to write a scheduled job to find out the opportunity created past 7 days and assign it to another set of owners.

 

when i tried the below code, i am getting some issues with createddate on SOQL.

 

below is my code,

 

Set<Opportunity> setopp = new Set<Opportunity>();
Map<ID,ID> mapFinalOutputOpp = new Map<ID,ID>();
Map<Id,String[]> mapOppInputs = new Map<ID,String[]>();
String AgentIds = Label.Agent_name_for_rerouting;
List<String> StrAgentIDLst= AgentIds.split(',', 5);
system.debug('agent lst'+StrAgentIDLst);
List<String> AgentIDLst = new list<String>();
// getting the strings from the label
for(String s:StrAgentIDLst){
system.debug('individual agent lst'+s);
//String AgentID = Id.valueOf(s);
AgentIDLst.add(s);
}
//fetching the opportunity
date d = system.today().addDays(-7);
system.debug('system date - 7'+d);
date d2 = system.today().addDays(-8);
system.debug('system date - 7'+d2);
for (String Ids:AgentIDLst){
List<Opportunity> lstopp = [Select ID, Inquiry_School__c,LeadSource,CampaignId,Inquiry_Degree__c from Opportunity where Owner.name =:Ids and CreatedDate >: d2 and CreatedDate <: d and StageName = 'Lead'];
setopp.addAll(lstopp);
lstopp=null;
}
system.debug('setopp size'+setopp.size());
system.debug('lstopp'+setopp );

 

Please let me know.

 

 

Hi,

 

I am trying to get the campaign id from the lead object but it is returning as null.

 

Set<ID> LeadIDs = new Set<ID>();
for(Lead l: lstLead) {
LeadIDs.add(l.id);
}

for(CampaignMember cM : [Select LeadId, CampaignId from CampaignMember where LeadId IN :LeadIDs]) {
system.debug('campiagn member test'+cM.leadid);
system.debug('campiagn member test'+cM.CampaignId);
MapFinalCampaignToLead.put(cM.LeadId,cM.CampaignId);

}

system.debug('MapFinalCampaignToLead'+MapFinalCampaignToLead.size());

 

 

i tried querying Select LeadId, CampaignId from CampaignMember where LeadId = 'XXX' it shows the campaign it if i comment out the convert code but when i have this code in my class which converts the lead to opp it is returining as NULL

 

Not converting lead - Querying - Gives camapign ID with same SOQL

 

Before converting - Querying - no campaign id returned.

 

Any help?

 

Regards

riffind

Hi,

 

I have created a custom object called referral and our portal user will refer and apex code inserts the record into the object.

 

referral and account are in look up relationship with account.

 

so all the referrals are tagged as related list in account.

 

i am trying to send email alert to Account owner whenever they get referral.

 

In the email alert wizard, i have selected receipent as Account owner but  account owner are not receiving alert.

 

Aariff

Hi,

 

I looked into the code, this error is hrown if i have the lookup field to opportunity from one of the custom object. If i comment this lookup field then i am getting the insert passed.

 

i checked for the access of the user, since this is portal user, i don't see opportunity in the profile for them. Anybody here to help me please.

 

here is the block of code

if (!(('').equalsignorecase(referralName2))){ 
                    if (!Pattern.matches('^[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$', referralemail2)) {
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, Label.App_Val_Error_Email_Format));
                    }else{              
                    referral__c ref3 = new referral__c();
                    ref3.Name__c = referralName2;
                    ref3.Related_Opportunity__c = this.opp.Opportunity__c;
                    ref3.Account__c = this.Opp.Account__c;
                    ref3.Email__c = referralemail2;
                    ref3.Phone__c = referralphone2;
                    insert ref3;
                    }
                    }

 

if i comment the below line, insert is getting passed.

 

ref3.Related_Opportunity__c = this.opp.Opportunity__c;

  Related opportunity is a custom lookup field on opportunity.

 

this.opp.Opportunity__c is having the the opportunity id, as i have the samething in the URL and i get the ID on it.

 

 

Hi,

 

i am adding an javascript function to an onclick event of an image. i am not getting the javascript working on clciking...below is my code

 

 <apex:image  url="{!URLFOR($Resource.Style,'/styling/images/icon.jpg')}" onclick="javascript&colon;SendData('page',execute,'yes');"/>

 

javascript file added is accessible from the page, oher functions are working....

 

if i add the same onclick event function to a button, it calls the javascript function. only the image is not triggering. but my requirment is to add it on the image onclick.

 

Please help.

 

 

I am using a workflow to update a field based on condition of a picklist. and on false condition, i don't want any update at all, because the record gets locked for other picklist values and it is throwing error since it was not able to update. how can i achielve the same.

 

IF( ISPICKVAL( StageName ,"lead") , "S","")

 

if stagename is lead, i want to update S in the field and don't want anything to do when it is not lead.

 

I have an issue going on, in my org we are using a custom setings with protected List values on it. values are available in UAT and Prod but if i deploy the same to Dev, only the custom settings and fields are coming in, the values are getting missed. How to add the values while deploying. Please provide your input.

Hi,

 

I did a successfull HTTP Post to an endpoint. i know it is not a good practise to hardcode the endpoint URL in the code itself. Is there anyway i can keep it globally and change it whenever we want. Please let me know. how others use it, so that i can implement the same. 

 

please provide your inputs



Hi,

 

I am trying to create a record with user inputs from different visual force page. I got struck in between.

 

like page 1 gets 2 user inputs and then navigate to page 2 and get 2 more inputs and then inserting the records. the problem is all the 4 fields in the record are mandatory. so if i save the fields after first page, it throws DML exception and if i save in page 2 also ith throws because the values of first page are missing.

 

There is no session object in salesforce i guess..what can i do to handle this situation.

 

 

Hi,

 

I am new to SF. can we create an object/tab and fields using APEX and visual force alone without using any of the customization functionality of salesforce.

 

i know we can implement business logic using controller/triggers etc but is it possible to create object itself and sameway fields, validation rules, formula for the fields etc etc.

 

Please clarify me.

Hi,

 

I wanted to become a salesforce developer, so i learned customization of salesforce , apex and visual force tutorials. now i want to understand how these are used in realtime.

 

1. from visual force i can create custom webpages and i can use the custom objects and custom fields to form my page. and i can write some controller, triggers to point of the object and kick off some processes. but do i have to really create objects and fields each time for a custom application?

 

2. is it possible to create custom objects and fields using apex? i know i can use the fields from visual force and i can have some business logic using apex. but can i depend of apex and visual force to create all custome obejcts etc.

 

3. how the apps are provided to the real user? does the user should have access to salesforce? consider i want to provide a webpage to user just only through link without salesforce login/ any registration. is that possible.

 

4.  how a development process will go from business requirement. 

 

Please help me in understanding these points of let me know if you know any blogs or video on this one. i searched in the community and google but i could not see any. 

 

Thanks

What will happen to validation rules and mandatory fields of an object when inserting records through apex class but not following validation rules or not providing the mandatory field values.

 

consider account object has name, city (mandatory), max_salary(has some validation rule), phone number fields.

 

if i insert

account s = new account (name =' bob', phone = '7896785678', max_salary='50000');

 

what will happen to this line while executing, will it fail because i have not provided mandatory field (city) and didn't follow validation rule for max_salary field. 

Hi,

 

I am trying to get fields of parents into my child visual force page. i am missing something which thorws error to get the values from parent

 

<apex:page standardController="Job_Posting__c" recordSetVar="Job_Postings" tabstyle="Job_Application__c" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{!Job_Postings}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.Position__c}"/>
<apex:column value="{!a.Position__c.Min_pay__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

Job_posting__c is the child of Poistion__c. min_pay__c is a field in Position object. first 2 fields are displaying correcty which is name name and position__c (there is also a custom field with the name position directly in child object)

I am using a custom stylesheet to reference a tabstyle in visula force page. the custom style sheet is available in static resources but then also i am getting error messages as below

 


Error: Invalid tabStyle 'TestStyles__tab' specified.

 

code attached below.

 

<apex:page standardController="Position__c" tabStyle="TestStyles__tab">
<apex:form >
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!Position__c.name}"/>
<apex:inputField value="{!Position__c.Location__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

I am trying to put  all the positions in the position object in a datatable using the visualforce. I am not sure how i can identify the field needed

 

<apex:page standardController="position__c">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are viewing the {!position__c.name} account.
</apex:pageBlock>
<apex:pageBlock title="table">
<apex:pageBlockTable value="{!position__c.???}" var="contact">
<apex:column value="{!Position__c.Name}"/>
<apex:column value="{!Position__c.location}"/>
 </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

I don't know what to mention in the ??? area and how i can point out the fields of the each position in a tabular form.

Hi,

I have created Facebook as authentication provider and the authentication works and take the user to standard login page.

i would like to take the customer portal to force.com site page.

i am referring this help page to add parameters in the URL but when i did and try to call the SSO URL it give me a error as Bad_id

https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_provider_addl_params_site.htm&language=en_US#sso_provider_addl_params_site.xml

the error message i get is below

https://cs8.salesforce.com/_nc_external/identity/sso/ui/AuthorizationError?ErrorCode=Bad_Id
Hi,

I have a VF page, which displays a list of record, each record has a link to edit and they can edit and come back to the list page.

But i want to display the changes made on these list of records, who is making the change, a simple log information kind at the bottom.

even if i go for history, it cannot capture for list of records and display on single VF page.

Please help.


User-added image

So how to write test class for conditional statement & Exceptions in order to achieve test coverage
The error is coming when i want to fetch customerUserTypes in Profile.

Set<String> customerUserTypes = new Set<String> {'CSPLiteUser', 'PowerPartner', 'PowerCustomerSuccess',   'CustomerSuccess'};
Account acc = new Account (
Name = 'newAcc1'
); 
insert acc;
Contact con = new Contact (
AccountId = acc.id,
LastName = 'portalTestUser'
);
insert con;
Profile p = [select Id,name from Profile where UserType in :customerUserTypes limit 1];

User newUser = new User(
profileId = p.id,
username = 'newUser@yahoo.com',
email = 'pb@ff.com',
emailencodingkey = 'UTF-8',
localesidkey = 'en_US',
languagelocalekey = 'en_US',
timezonesidkey = 'America/Los_Angeles',
alias='nuser',
lastname='lastname',
contactId = con.id
);
insert newUser;
Hi,

I have created Facebook as authentication provider and the authentication works and take the user to standard login page.

i would like to take the customer portal to force.com site page.

i am referring this help page to add parameters in the URL but when i did and try to call the SSO URL it give me a error as Bad_id

https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_provider_addl_params_site.htm&language=en_US#sso_provider_addl_params_site.xml

the error message i get is below

https://cs8.salesforce.com/_nc_external/identity/sso/ui/AuthorizationError?ErrorCode=Bad_Id
Hi,

We have customer portal, where user sign up and uses the portal. in some case, when the user closes the window and try to access customer portal in the same browser, it is loading only the VF template but not the page. The session of the user is not timed out and it behaves this way, if the user session timeout(it is 30 minutes), then the user is able to login successfull. else after login it loads only the template.

i tried adding a javascript and do the login and a page reference to go back to the last left page but it is not happening.

did anyone faced this issue?


Hi All,

in my APEX code, i pull the owner id and owner active status. if i check the status with system.debug, it shows as False (where the owner is active). if i copy paste the same SOQL and check in developer console -> query editor, i am getting status as TRUE.

I don't know, how to handle this. can someone please point me where am missing?

Below is the APEX code,

userPersonAccount = [
                select
                Id,
                FirstName,
                LastName,
                Middle_Name__pc,
                OwnerId,
                Owner.IsActive,
                PersonEmail,
                (select
                    Id,
                    StageName,
                    Opportunity_Status__c,
                    isClosed,
                    Application_Step__c
                    From Account.Opportunities
                    Where StageName  = 'Application'
                )
                from Account where Id =: currentUser.get(0).AccountId];
            System.debug('\nAcocunt : '+ userPersonAccount);
            system.debug('owner active?'+userPersonAccount.Owner.IsActive);

Tried login to salesforce using the new saleforce1 app after entering my domain url in settings , this correctly redirects to our internal SSO page and after authentication on redirect back to salesforce.com, getting oauth error- remote access authorization error . Click on

'Are you not XYZ? link ,takes to grand permission auath page, click on allow login to salesforce.com. Not sure why this is happening, anyone else has the same issue?

 

 

which Tag will automatically  execute when VF page loaded  ?

Hi 

 

Facet not working on my table and I can not find how to make the first column  looks as a saleforce row header...

Thanks for your help

 

 

<apex:pageBlock >


<apex:pageBlockSection collapsible="true" title="table 1" columns="1">
<apex:PageBlockTable columns="{!colLabels.size+1}"
rows="{!rowLabels.size+1}" value="{!LBItems}" var="it">

<apex:column >
<apex:outputlabel value="{!it.rowlabel}" / >
</apex:column>

<apex:repeat value="{!it.rowBoxIt}" var="rbi">
<apex:column >
<apex:facet name="header" >{!rbi.colLabel}
</apex:facet>
<apex:outputlabel value="{!rbi.name}" / >
</apex:column>

</apex:repeat>

</apex:PageBlockTable>
</apex:pageBlockSection>

  • September 19, 2012
  • Like
  • 0

Hi, everyone

 

I need your help to understand and fix this problem:

I built an apex text class in a sandbox environment (i'm using eclipse) but when I run this apex test class I'm getting this error: System.QueryException: List has no rows for assignment to SObject. The problem is that the object really has records both in sandbox and in production environment !!!! I run that query in Force.com Explorer, salesforce.shema Explorer, etc. and there I can see the existing records but in the test all the time throws that error... Could anyone please guide me why is it happening and how can it be fixed?

I have an application external from SFDC written in html/Javascript that needs to be able to query lead information for a specified sales rep within SFDC.  I am looking at the AJAX Developers toolkit but I am having problems creating the connection and loging in.  I have included <script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script> in my javascript code, but continue to receive error  "Error: System error: -2146697211." when trying to issue the login command formatted as

 

var result = sforce.connection.login("xxx-id", "xxx-password");

What is needed to create a connection and login thru javascript

  • September 30, 2010
  • Like
  • 0

Hi I am very new to salesforce.

My question is can I establish a connection using AJAX toolkit from outside html page.

 ex:

I have a html page in my desktop with following code

 

 

<html>
<head>
<script language="javascript" type="text/javascript" src="http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js"></script>
<script>
function setupPage() {
var user = sforceClient.login("name@mail.net", "123");
}
</script>
</head>

<body onload=setupPage()>
<div id=userNameArea>
</div>
</body>
</html>

 Butthe code does not seem to be working. Not establish the connection

 

Any help?


 

 

 

Message Edited by deshan on 02-09-2010 10:41 PM
  • February 10, 2010
  • Like
  • 0

Hi

 

I have a page where I have used the "connection.js" to Login into a Salesforce instance.

 

But I am receiving errors when I try to do this.

 

When I host it from a Local Server or on a Salesforce Sites page, I get the error:

 

[Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location: "https://na6.salesforce.com/soap/ajax/16.0/connection.js Line: 594"]

 

Can anyone tell me why this error occurs? And what should be done for successful Login?

 

I have provided my code below. Its a simple JS code that calls the Login method.

 

 

================ CODE ==============================

 

<HTML>
<HEAD>

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

<script type="text/javascript" >

function logincall()
{

    try{
   
    sforce.connection.serverUrl = 'http://www.salesforce.com';
   
    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>

 

================ CODE ==============================

  • November 09, 2009
  • Like
  • 0
>>All,
>>
>>Does anyone know if it is at all possible to get access to to the POST data from a visualforce page when posting from another domain. The >>example below works fine for GET but I actually prefer to use POST if at all possible.
>>
>>-Tom
 
Nevermind,
 
I was able to get the POST values using the same technique for GET fields by using.
ApexPages.CurrentPage().getParameters()
 
only caveat is you must post to the true url in my case:
 c.cs2.visual.force.com/apex/mypage
 
luckily the $Page.mypage returns the true url.
 
Sorry about the previous Message,  my sample code seemed to hose the page so I could not reply or remove
(don't use chrome to post messages and paste code).
 
-Tom
 
 
well here is the working code:
 
Code:
<apex:page>
<h1>Wrapper to Punchout Site</h1>
 <br></br><b>Browser Post URL:</b>  {!$Page.testProxy}
 <br></br>
 <apex:iframe src="http://127.0.0.1/fakePunchout/submitPOOM.html" id="Iframe_Punchout"/>
</apex:page>

----------------------------------------------------------------
submitPOOM.html
----------------------------------------------------------------
<html>
<body>
    <h1>DEMO Punchout FORM POST</h1>
    <form action="https://c.cs2.visual.force.com/apex/testProxy" method="POST" target="_top">
  <br/><input type="text" name="cxml-urlencoded" id="payload2" value="POST Entire URL-Encoded PunchOutOrderMessage"/>
        <input type="submit" value="confirm"/>
    </form>
    <br/><br/>

 <h1>DEMO Punchout FORM GET</h1>
    <form action="https://cs2.salesforce.com/apex/testProxy" method="GET" target="_top">
     <br/><input type="text" name="cxml-urlencoded" id="payload3" value="GET Entire URL-Encoded PunchOutOrderMessage"/>
        <input type="submit" value="confirm"/>
    </form>
</body>
</html>
----------------------------------------------------------------
testProxy
----------------------------------------------------------------

<apex:page controller="testProxy" action="{!init}">
  <form>
  <h1>SFDC - DEMO PROCESS POOM</h1> 
  <br></br>
  <textarea name="payload" style="width:500px;height=400px;">{!cxml}</textarea>
  <br></br>
  {!headers}
   <br></br>
  </form>
</apex:page>
----------------------------------------------------------------
public class testProxy {
    public string cxml{get; set;}
    public string headers {get; set;}

    public PageReference init() {
     if ( ApexPages.currentPage().getParameters().get('cxml-urlencoded') != null )
         cxml = ApexPages.currentPage().getParameters().get('cxml-urlencoded');
         
        headers='';
        MAP<string, string> hdrs = ApexPages.currentPage().getheaders();
        for (string key : hdrs.keySet() )
            headers += key + ' : ' + hdrs.get(key) + '\n';
    
        return null;
    }
}

 
 
 


Message Edited by tesii on 01-06-2009 12:35 PM

Message Edited by tesii on 01-06-2009 12:36 PM
Please be gentle, I'm new to SalesForce
 
I've written a web application. All I need to do is send the data gathered by the web page back to SalesForce.com using JavaScript, hence the Ajax toolkit.
 
But I can't seem to get started. I've read all the manuals I can find and looked at all the sample code.
 
However, I can't even get the Ajax Toolkit loaded.
 
Every example uses something like the following:
 
<script src="/soap/ajax/11.1/connection.js" type="text/javascript"></<script src="/soap/ajax/11.1/connection.js" type="text/javascript">
 
Of course, this script uses a relative address to some location on SalesForce.com.
 
How do I access the toolkit from a browser? Is there a fully-qualified URL I can use for the .js file?
I can't find that information anywhere.
 
Also, which revision should I be using?
 
Thank you. I'm stuck :-)
 
Alan A. Katz