• Sam.arj
  • NEWBIE
  • 230 Points
  • Member since 2008

  • Chatter
    Feed
  • 9
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 34
    Questions
  • 171
    Replies

Hello,

 

I'm trying to get user information(customer portal user= contact)  in Apex class and trigger.

but I don't know how to get customer portal user infomation on Apex.

 

I want to add accountId to customObjectA when customObjectA created by custom portal user.

 

trigger instAccount on ProductNS__c (before insert) {
ProductNS__c[] pns = Trigger.new;
putAccountData.addDeleverCustomer(a)}
}
public with sharing class putAccountData {
public static void addDeleverCustomer(CustomObj A){
ID uid = UserID;//I get logined user's userId,contactId,accountId, here.
If (A.AccountId == null){
ID cid = [select ContactId from User where Id = uid];
ID aid = [select AccountId from Contact where Id = cid];
A.AccountId = aid;
}
}
}
 

 

Please help, how to get userId.

Thank you.

 

sihmeieos

Hey everyone,

 

I am hoping someone here with more knowledge than me may be able to offer some help/guidance/input. Anything is really appreciated.

 

I have some input fields on a VF page and I want the text to save and display on the main page (the display page) the same as the user types it in the input field (including line-breaks). Is there any documentation that explains how to do this?

 

Thanks again,

 

Shannon

Hello

 

can someone help me how to display only the date value

 

 expiration_date__c field is defined as datetime. so it is displaying the value as Sun May 31 19:00:00 GMT 2009.

 

But i want to display the  expiration_date__c value as 5/31/2009

 

 

 

<apex:page controller="Travelling_Home" action="{!init}"> <apex:form > Your expiration date is {!tvtresults.expiration_date__c} </apex:form> </apex:page>

 

 

public class Travelling_Home { Travelling__c tvt; public Travelling__c gettvtresults() { return tvt; } public PageReference init() { if(tvt==null) tvt=[select place__c,expiration_date__c from Travelling__c__c where expiration_date__c>=TODAY and USER_ID__c=:UserInfo.getUserId() limit 1]; return null;

} }

 

 

My goal in this page is to be able to rename the standard related list "Notes And Attachments" to something else. Since this is a standard related list, it cannot be changed without Visualforce (AFAIK).

 

I have successfullly created a visualforce page to display the Account object, and was able to manually add all the related lists (and rename the notes and attachments related list), but my problem is that i have some custom objects that are hidden from many users. By adding them manually, these users will get errors in viewing the page if it's overriden. Is there a way to render the <apex:Detail relatedlist="false">, add the Notes And Attachment related list (renamed of course), and then have all the rest of the generated lists <apex:detail relatedlist="true"> ??

 

I tried to do it here, but obviously it adds the AccountDetail twice.:

 

 

<apex:page standardController="Account"> <apex:detail relatedList="false"/> <apex:relatedList list="NotesAndAttachments" title="Notes And Attachments (Topic Memo)"/> <apex:detail relatedList="true" /> </apex:page>

 

 

 

 
Hi,

 

I would like to mimic a bit of Salesforce behavior in a Visualforce Page I'm creating.

 

Examples: When you're on a Contact page and you click New Task, the contact's detail is filled in for you.  When you're on an Opportunity page and you click New Task, the opportunity's detail gets placed in the Related To box for you.  There are countless examples of this behavior all over Salesforce

 

I have a custom object called Trial.  It has lookup fields called Campaign, Contact and Opportunity which I'm putting on my custom Visualforce Page which represents a wizard's "Step 1." 

 

I'll add a custom button on Campaign, Contact and Opportunity called "New Trial" which will call this page and pass parameters to it off the record it's being called from.

 

On the page, I've got the three fields as  <apex:inputField>.   How do I get values in those fields the same way Salesforce does?

I have an <apex:column> in a pageBlockTable that is a name from an SObject.  I want it to be a link such that when a user clicks on it, it goes to the page for the id of that object.

 

Can that be done or do I have to use something other than apex:pageblocktable and apex:column ?

 

Hi,
 
I have textarea field and when I hit save button I need to send this value to save method inside controller.
Code:
<apex:inputTextarea id="personaltag_edit_area" rows="1"  cols="50100"/>

 when user hit save button I need to send this value (whatever user type in this textarea) to save method inside controller class and want to save this value in account tag table.
 
Can someone point me how to redirect value in controller?
 
-Thanks in advance
I don't understand why I'm getting the error :
 
ErrorError: Unknown property 'MyOpenActivities.MyCasesToDo'
 
Here's the page code:
 
Code:
<apex:page controller="MyOpenActivities">
    <apex:form >
    <apex:pageblock Title="Hello {!$User.FirstName} {!$User.LastName}" id="TitleBlock">
        <h1> Version 1.0 </h1><br />
        Here are the lists for open Technical Support Activities that require your attention.<br />
        Open Cases, Service Activity and Demos.<br />
    </apex:pageblock>
    </apex:form>
    
    <apex:form >
    <apex:pageblock title="My Open Cases">
    
       <apex:pageBlockTable value="{!MyCasesToDo}" var="c">
        
        </apex:pageblocktable>
    </apex:pageblock>
    </apex:form>
</apex:page>

 
Here's the controller:
 
Code:
public class MyOpenActivities {

Public String CurrentUserId {get; set;}
Public List<Case> MyCasesToDo;

Public MyOpenActivities(){
 this.CurrentUserId=UserInfo.getUserId();
}

public List<Case> getMyCasesToDo(string CurrentUserId){
 List<Case> MyCasesToDo = new Case[]{};
 MyCasesToDo = [Select OwnerId, Subject, Status, Service__c, Priority, Origin, Id, Description, ContactId, Account.Name, AccountId From Case Where OwnerId = :CurrentUserId];
 return MyCasesToDo; 
}
 
Static testMethod void testThisController() {
 MyOpenActivities testController = new MyOpenActivities();
 string CurrentUserId=UserInfo.getUserId();
 testController.getMyCasesToDo(CurrentUserId);
 
}

}

 
I've done this exactly the same way on quite a number of other page/controllers.  Any idea why it's happening now?
 
  • September 26, 2008
  • Like
  • 0

When creating a recurring task using Apex, how I can set the reminder to get the same functionality as what UI offers?

 

The Task object has only a "ReminderDateTime"! 

 

Task t = new Task();

t.Subject = 'Test';

t.IsReminderSet = true;

t.RecurrenceType = 'RecursEveryWeekday';

t.RecurrenceDayOfWeekMask = 62;

t.ReminderDateTime = ??   //this is a date time field, How to set to : "On occurrence date" at "8:00 am" for each occurrence? 

 

insert t;

 

 

We have  asp.net website where we publish our company events.

 

The source of the events are Salesforce Campaigns, we have a added a Rich Text field to Campaign to hold the public Campaign description and using APIs we want to show the events on our website.

 

When users load images into Rich Text field, we cannot view these images in our public website. The rest of the content is added to the web page as HTML just fine.

If seems that SF expect the viewer to be logged into Salesforce to be able to view these images.

 

Is there any way to make these Rich Text images public?

We have  asp.net website where we publish our company events.

 

The source of the events are Salesforce Campaigns, we have a added a Rich Text field to Campaign to hold the public Campaign description and using APIs we want to show the events on our website.

 

When users load images into Rich Text field, we cannot view these images in our public website. The rest of the content is added to the web page as HTML just fine.

If seems that SF expect the viewer to be logged into Salesforce to be able to view these images.

 

Is there any way to make these Rich Text images public?

 

 

I have overridden the Opportunity's clone button with a Visualforce page and an extention apex class.

There is no code in my extention class and nothing in the Visualforce page:

 

<apex:page standardController="Opportunity" extensions="OpportunityCloneController" action="{!init}">
  
</apex:page>

 The Controller class:

public with sharing class OpportunityCloneController {
    private Opportunity opp = null;
    
    public OpportunityCloneController(ApexPages.StandardController controller) {
        opp = (Opportunity)controller.getRecord();
    }
    
    public PageReference init()
    {
      return null;
    }
}

   Here the link produced when i click on the clone button:

  

/apex/OpportunityClone?clone=1&retURL={VALUE}&scontrolCaching=1&sfdc.override=1&id={VALUE}

 



   However when i click save the apex class gets saved but i get an error message and does not seem to save the VF page:

   Error: Required fields are missing: Label

   

   I am not sure what this error message means!

   Any help is appreciated

  

I am using actionSupport control to refresh an area of a page where there are three dependent pick-lists are included.

 

Everything works just fine the only problem is that once the actionSupport updates the page portion, the multi-pick list shown loses it's buttons!!

 

 

<apex:pageBlockSection columns="1" id="industryBlock">
<apex:pageBlockSectionItem>
<apex:outputLabel value="Industry Type"></apex:outputLabel>
<apex:outputPanel layout="none">
<apex:actionRegion >
<apex:inputField value="{!item.Industry_Type__c}" required="true">
<apex:actionSupport event="onchange" reRender="industryBlock"/>
</apex:inputField>
</apex:actionRegion>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >&nbsp;</apex:pageBlockSectionItem>

<apex:inputField value="{!item.picklist1__c}" rendered="{!item.Industry_Type__c='vallue1'}" required="true"/>
<apex:inputField value="{!item.picklist2__c}" rendered="{!item.Industry_Type__c='vallue1'}" required="true"/>
<apex:inputField value="{!item.picklist3__c}" rendered="{!item.Industry_Type__c='vallue1'}" required="true"/>
</apex:pageBlockSection>

 

Any help is appreciated!

I have a repeater within a javascript block, once a user clicks on a link that calls the javascript function of my actionFunction, the selected area refreshs. However, the javascript block is not executed again on the Ajax refresh.

 

 

<div id="msgdiv"></div> <apex:outputPanel id="refreshArea"> <script type="text/javascript"> function test() { var msg = ""; <apex:repeat value="{!Strings}" var="item"> msg += '{!item}-'; </apex:repeat> document.getElementById('msgdiv').innerHTML = msg; }

//works ok only on first page load

test(); </script>

Here is te actionFunction definition on the page:

 

<apex:actionFunction name="AddNewString" action="{!addString}" reRender="refreshArea" status="status"></apex:actionFunction> <a href="javascript:AddNewString()">test adding a string</a>

 In order to make the javascript call, I tried both actionStatus "onstop" event and actionFunction "oncomplete".

 

 Here  are the results:

 1) actionFucntion:

<apex:actionFunction name="AddNewString" action="{!addString}" reRender="refreshArea" oncomplete="test()"></apex:actionFunction>

 

 

 actionFunction oncomplete: won't call the javascript function!

 

 2) actionStatus:

  

<apex:actionStatus startText="working..." onstop="test()" id="status"></apex:actionStatus>

This one calls the javascript, in the HTML source code also I can see the javascript block is updated, however the previous text is shown. As if the actionStatus has called the javascript just before the DOM is updated by Ajax call.

 

This is very strange!
 
By the way, if I remove the javascript block and just flush out everything into the browser it works fine!

Anyone can help shed some light on this issue?


 

 

 

 

 

I have a force.com site with login enabled (to do this you need to associated your site with a customer portal)

 

My problem is that even though I have turned off the "standard styles" on my Visualforce pages, the customer portal CSS links still appear on the HTML code and create problems.

 

Is there anyway to get rid of customer protal CSS styles?

 

What if someone wanted to brand their force.com secure site without using anything predefined CSS styles?

Hi
This took us a long time to discover but the following two scenarios will cause the method: Site.createPortalUser() to throw a bug big time.

1) if the Account ID passed to this method refers to an account which its owner is a portal "Guest" user or is from a "Customer portal profile". (hint: Portal guest does not have a role)

2) If the Account ID passed to this method refers to an account which its owner is an inactive user.

 

I hope this helps those who are struggling to understand what is going wrong with their sites:

 

This is the error message we receive:

 

There was an error in registering a user for site registrations. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact <a href="mailto:support@salesforce.com">support@salesforce.com</a>. Please indicate the URL of the page you were requesting as well as any other related information. We apologize for the inconvenience. <br/><br/>Thank you again for your patience and assistance. And thanks for using Salesforce.com! <br/><br/>Error ID:1521060844-1426 (-2007103269)

Message Edited by Sam.arj on 12-07-2009 08:20 AM
Message Edited by Sam.arj on 12-08-2009 07:13 PM

These days i am developing a solution for one of clients based sites and customer portal.

 

I end up spending hours looking at the data, my code, debug log (which most often does not contain any useful data, a whole wack of items that were successful! ) and stare at an "under construction message" screenshot that the user sends me (as a result of an error they encoutered)

 

No error emails are sent to me about the failure... so most of the time i am lost!
I have no idea what going is on!

and you are hearing these words from a Salesforce Certified developer with more than 13 years of software development exprience!

 

I am hoping with these harsh words SF folks would be able to step up and fix the problem with this technology.

 

Hi,

 

I have setup my customer portal and a form (visualforce page) by which the user (after login / register) can update his/her profile.

 

Fields such as First Name, Last Name and Company Name is prompted and the user can update those.

 

As part of requirement I need to update the contact record associated with the "user" record as user updates his/her profile (above fields).

 

Also If the CompanyName has changed I need to create a new Account and link the contact to the new Account.

 

trigger UpdateContactFromPortalUser on User (after update) { List<Contact> contactsToUpdate = new List<Contact>(); List<string> AccountNames = new List<string>(); List<Account> Accounts = new List<Account>(); Map<String, Account> NewAccounts = new Map<String, Account>(); for(User u : Trigger.new) { String contactId = u.ContactId; if (contactId!=null && contactId!='') { AccountNames.add(u.CompanyName); } } if (AccountNames.size() > 0) Accounts = [SELECT id, name FROM account where Name in :AccountNames]; for (User u : Trigger.new) { String contactId = u.ContactId; if (contactId!=null && contactId!='' && u.PortalFlag__c == true) { Contact c = new Contact(Id=contactId); c.Email = u.Email; c.Salutation = u.Salutation__c; c.FirstName = u.FirstName; c.LastName = u.LastName; c.Title = u.Title; c.Phone = u.Phone; c.MailingStreet = u.Street; c.MailingCity = u.City; c.MailingState = u.State; c.MailingPostalCode = u.PostalCode; c.MailingCountry = u.Country; c.Department = u.Department; boolean AccountFound = false; for(Account acc : Accounts) { if (acc.Name == u.CompanyName) { c.AccountId = acc.Id; AccountFound = true; break; } } if (!AccountFound && (u.CompanyName != null && u.CompanyName != '')) { NewAccounts.put(c.Id, new Account(Name=u.CompanyName)); } contactsToUpdate.add(c); } }//loop if (contactsToUpdate.size()>0) { if (NewAccounts.size()>0) { List<Account> newaccs = NewAccounts.values(); insert newaccs; NewAccounts.putAll(newaccs); for(Contact c : contactsToUpdate) if (NewAccounts.get(c.Id) != null) { c.AccountId = NewAccounts.get(c.Id).id; } } for(Contact c : contactsToUpdate) { Utils.UpdateContact(c.Id, c.AccountId, c.Email, c.Salutation, c.FirstName, c.LastName, c.Title, c.Phone, c.MailingStreet, c.MailingCity, c.MailingState, c.MailingPostalCode, c.MailingCountry, c.Department, c.HomePhone, c.OtherStreet, c.OtherCity, c.OtherPostalCode, c.OtherState); } //update contactsToUpdate; }//contactsToUpdate end if }

 

 

 I tired two ways of doing this, one to process the records and directly update the contacts and second solution to right a method with @future prefix so that the contact records would get updated asynchroniously.

 

My problem is that at some Occassional cases I receive an error as below but NOT ALL THE TIMES!!

 

Debug Log:
System.DmlException: Update failed. First exception on row 0 with id 0038000000lmYXtAAM; first error: UNKNOWN_EXCEPTION, portal account owner must have a role: []

 

 

 

I have a Customer portal and force.com Site working together.

 

Under the customer portal profile I have added a visualforce page which needs run SOQL code and DML operations.

 

When go to the URL of my site:

 https://myorg.sandboxName.cs1.force.com/mysite/myVF-Page

 

It prompts me to login and authenticate, prefect so far...

 

However when I login, it forwards me to "Unauthorized" page with a message that says:

Error: Error occurred while loading a Visualforce page. 

 

I enabled the Debug log for that user and these are the things I see in the log file:

 


Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.


Ihave no idea how to fix this problem, the custom profile that is clonedfrom "Customer Portal Manager Standard" profile has "API enabled" set.

What else should I do to make this work?

 

  • September 21, 2009
  • Like
  • 0

In my site login is enable for example if I set IdeasHome as my site's home page the login page is prompted and forces the user to eithe login or sign up.

 

however when I make a Visualforce page the default page guest user can browse it without any authentication!

 

Is there any place where I can set this page as restricted page and force login before this page is viewed?

 

In the "public settings" I have removed the visualforce page asumming either this would force the login requirement or at least give an access denied message

None of the above the page is still being view with no problems!

 

Any iadea?

 

  • September 17, 2009
  • Like
  • 0

Hi

In our company we need to support login and self-registration features on a force.com site that we have developed. 

 

In production instance when I go to the site  "login Settings" I see the "edit" button where I can enable login functionality however in sandbox this button "Edit" is not available, we prefer to test everything in sandbox before roll it out to production.

 

How can I try login functionality before deploying it to production?

 

 Thanks

  • September 17, 2009
  • Like
  • 0

I have a requirement to have a selectList on a custom component with a command button.

 

When everything works fine, but when i use my custom component along with other components which require validation, my command button inside the component will not fire the action because the validation of components on the parent page fails.

 

So I add the immidiate attribute to the command button, to force the action get fired without considering other components validation requirements in parent VF page.

 

As a result the selectList no longer maintains it's state or in other words "value" attribute is not set anymore!

 

here is my code:

 

 

<!-- Component Source -->
<apex:component controller="zTestComponent" >

<apex:outputPanel id="thepanel">

<apex:selectList value="{!Items}" multiselect="true">
<apex:selectOptions value="{!options}"> </apex:selectOptions>
</apex:selectList>
<apex:commandButton value="submit" action="{!submitMethod}" rerender="thepanel" immediate="true"/>
<apex:outputLabel value="{!message}"></apex:outputLabel>

</apex:outputPanel>

</apex:component>

 

/* Component Controller */
public class zTestComponent {

private List<SelectOption> op = new List<SelectOption>();
public List<SelectOption> options {
get {
if (op.size() <= 0) {
// List<SelectOption> op = new List<SelectOption>();
op.add(new SelectOption('1','test 1'));
op.add(new SelectOption('2','test 2'));
}

return op;
}
}

public List<string> items = new List<String>();
public List<String> getItems() {
return items;
}
public void setItems(List<String> items) {
this.items = items;
}

public string message { get; set; }

public PageReference submitMethod() {
message = '';

if (items != null)
for(string item : items) {
message += item + ',';
}

return null;
}
}

 

 

  Parent VF Page:

<apex:page controller="someController">
<apex:form id="theform">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="test" reRender="theform"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >

<c:zTestComponent />
<apex:pageBlockSectionItem >
Text:
<apex:inputField value="{!NewTask.Subject}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

public class someController {
public Task NewTask { get; set; }
public someController()
{
NewTask = new Task();
}
}

 I really appreciate if you could provide me with a solution.

 

I am developing a custom component that has one SelectList and one Command button.

The selectlist is in multi-select mode so an array of string is prepared to capture user selection.

When the button is clicked, an output label will show the values.

 

Here is the code:

 

 

<apex:component controller="zTestComponent" >

<apex:outputPanel id="thepanel">

<apex:selectList value="{!items}" multiselect="true">
<apex:selectOptions value="{!options}"> </apex:selectOptions>
</apex:selectList>
<apex:commandButton value="submit" action="{!submitMethod}" rerender="thepanel"/>
<apex:outputLabel value="{!message}"></apex:outputLabel>

</apex:outputPanel>

</apex:component>

public class zTestComponent {

public List<SelectOption> options
{
get
{
List<SelectOption> op = new List<SelectOption>();
op.add(new SelectOption('1','test 1'));
op.add(new SelectOption('2','test 2'));
return op;
}
}

public List<string> items
{
get;
set;
}

public string message { get; set; }

public PageReference submitMethod() {
message = '';


if (items != null)
for(string item : items)
{
message += item + ',';
}

return null;
}
}

 

 When the button is clicked, the items variable is always null?!  Any one knows why?

 

I have a requirements to pass a list of "SelectOption" items to my component, it seems that this type is not supported for "attribute" tag.

 

Has anybody encoutered this problem?

I have a PDF form with various checkbox, text and dropdown controls.


I need to populate some of these fields before view it to user and then the user needs to fill out the rest of the fields left empty.

 

Standard Visualforce "RenderAs" PDF does not seem to be the solution.

 

 

Has anyone had any exprience with the above problem?

Hi

I am done a lot of search in Salesforce.com and can not find anywhere an indication whether the VF customization can be used in offline edition?

 

I can not use my sandbox cerdentials to login into the offlline edition either to check things out before moving the customizations into live production instance.

 

Thanks in advance for your attention.

Hi

In the process of adding some customization to make Salesforce work based on our org's pricing model, we need to a few more fields to PriceBook and PriceBookEntry objects.

 

I do not see these two object under customize section of the seup page. Is there any plans to support customizing these objects?

Thanks!

Using salesforce forecasting tool, I need to capture manager comments for overrides for historical purposes.

Is it possible to have a trigger on OpportunityOverride or LineItemOverride objects?


When creating a recurring task using Apex, how I can set the reminder to get the same functionality as what UI offers?

 

The Task object has only a "ReminderDateTime"! 

 

Task t = new Task();

t.Subject = 'Test';

t.IsReminderSet = true;

t.RecurrenceType = 'RecursEveryWeekday';

t.RecurrenceDayOfWeekMask = 62;

t.ReminderDateTime = ??   //this is a date time field, How to set to : "On occurrence date" at "8:00 am" for each occurrence? 

 

insert t;

 

 

Is it possible to have to different custom domains redirect to two different sites within the same Salesforce instance?

 

For example, BigCompany sells Widgets and Sprockets and their accessories.  They track the sales, house the product descriptions, etc. for both in their one-and-only Salesforce instance; however, both are branded as completely different companies to the public, so both should have different domains and should be two different Force.com sites.

 

We'd set up a bigcompany.force.com/widgets site and a bigcompany.force.com/sprockets site.  We'd like to be able to create two different custom web address to point to each Force.com site:

  www.widgetsusa.com --> bigcompany.force.com/widgets

  www.sprocketsinmypockets.com --> bigcompany.force.com/sprockets

 

Is this possible?  When looking at the documentation it appears that it isn't...

It looks like we'd have to have something like widgets.bigcompany.com and sprocketsinmypockets.bigcompany.com as the custom web addresses.  Is that correct?

 

Hello,

 

I want to use the Customer Portal to allow my customers to get in touch with each other.  To do this, ideally, they log into the customer portal, and their user information is visible via list views to other customer portal users, and vice versa.  What this would essentially be is a directory of Customer Portal users that could be looked at using standard list views.

 

I've been doing some testing, and it seems as if Contacts are not available to be seen by other Contacts.  Since all my member information is at the Contact level, what the best way to approach this problem?

 

I'm guessing that I'm going to have to set up a custome object called "Portal Profile" or something liket that, which copies certain information off of the Contact record and stores it in the custom object, which I would then share in the portal.

 

Open to thoughts and feedback on this approach.

I have a repeater within a javascript block, once a user clicks on a link that calls the javascript function of my actionFunction, the selected area refreshs. However, the javascript block is not executed again on the Ajax refresh.

 

 

<div id="msgdiv"></div> <apex:outputPanel id="refreshArea"> <script type="text/javascript"> function test() { var msg = ""; <apex:repeat value="{!Strings}" var="item"> msg += '{!item}-'; </apex:repeat> document.getElementById('msgdiv').innerHTML = msg; }

//works ok only on first page load

test(); </script>

Here is te actionFunction definition on the page:

 

<apex:actionFunction name="AddNewString" action="{!addString}" reRender="refreshArea" status="status"></apex:actionFunction> <a href="javascript:AddNewString()">test adding a string</a>

 In order to make the javascript call, I tried both actionStatus "onstop" event and actionFunction "oncomplete".

 

 Here  are the results:

 1) actionFucntion:

<apex:actionFunction name="AddNewString" action="{!addString}" reRender="refreshArea" oncomplete="test()"></apex:actionFunction>

 

 

 actionFunction oncomplete: won't call the javascript function!

 

 2) actionStatus:

  

<apex:actionStatus startText="working..." onstop="test()" id="status"></apex:actionStatus>

This one calls the javascript, in the HTML source code also I can see the javascript block is updated, however the previous text is shown. As if the actionStatus has called the javascript just before the DOM is updated by Ajax call.

 

This is very strange!
 
By the way, if I remove the javascript block and just flush out everything into the browser it works fine!

Anyone can help shed some light on this issue?


 

 

 

 

 

Hi to all,
I want to create user in my organisation through code using contact record values.
I use the User's Username as contact Email Field.

How do I check the Email id is not repeated in whole salesforce DB???
Is there any global functions are there???
Send me the sample code...

Thanks,
Krish.
  • January 25, 2010
  • Like
  • 0

Hi 

 

I am working on developing a dummy website with my developer edition. I want that a user (having record on account/ contact) is able to login on force.com sites and submit document for contest. 

I am trying to enable login on force.com sites. but its not working. Login settings doesn't provide me with any edit option. 

 

Is there any work around for it?

 

I am trying to implement it on my trial version since I am not looking for any commercial use. 

 

 thanks in advance

i have created this vf page. How can I create a hyperlink so that when they click on subject, it takes them to the event record

 

<apex:page standardController="contact"   extensions="ActivityController">
<apex:pageBlock title="Event History" >
<apex:pageBlockTable value="{!Activities}" var="a">
<apex:column value="{!a.activitydate}" />
<apex:column value="{!a.subject}"/>
<apex:column value="{!a.whoid}"/>
<apex:column value="{!a.whatid}"/>
<apex:column value="{!a.type}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

I have found multiple posts on how to edit the apex:page line so that when the VF page is activated, it saves itself to an excel file:

 

<apex:page cache="true" contentType="application/vnd.ms-excel#test.xls" controller="StoreController" language="english">

 

But what I need to do is display the VF page with the panelGrid.  Then the user can click a button or link that will export the grid to excel.

 

I was thinking of just creating a second visualforce page that contains the above apex:page line, but I don't know how to add that logic to a button/link.

 

Thanks

 

Todd 

Hello everyone,

 

I've been having an issue in the last weeks, it all started in sandbox and now I'm seeing the same behavior in production and that's why I need your help.

 

When using my VF pages in Customer Portal, the colors of sections and fonts (defined in the Customer Portal customization section) change completely when doing an AJAX call, this is very strange since it was working without any problems. I noticed this only happens in Customer Portal, any ideas?

 

Thanks in advance!

 

Message Edited by jonathan rico on 12-28-2009 08:12 PM

I'm brand new to Visualforce and coding in general, and am trying to figure out how to filter the record results pouring in to my Visualforce Page from a standard controller pulling opportunity records:

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false" 

standardController="Opportunity" recordSetVar="screening">

 

I want to only show records based around the value of a field on the opportunity page.

 

Thanks in advance for your help. 

 

 

Hello,

 

I'm trying to get user information(customer portal user= contact)  in Apex class and trigger.

but I don't know how to get customer portal user infomation on Apex.

 

I want to add accountId to customObjectA when customObjectA created by custom portal user.

 

trigger instAccount on ProductNS__c (before insert) {
ProductNS__c[] pns = Trigger.new;
putAccountData.addDeleverCustomer(a)}
}
public with sharing class putAccountData {
public static void addDeleverCustomer(CustomObj A){
ID uid = UserID;//I get logined user's userId,contactId,accountId, here.
If (A.AccountId == null){
ID cid = [select ContactId from User where Id = uid];
ID aid = [select AccountId from Contact where Id = cid];
A.AccountId = aid;
}
}
}
 

 

Please help, how to get userId.

Thank you.

 

sihmeieos

I have a new process where I'd like to send a letter to all the contacts on an Account when an opportunity is won.

 

When the stage = Closed/Won, it would trigger a pop up dialogue that says

1)Do you want to send a letter (yes or no)

No would end the dialogue and yes would prompt the next question

2) Choose a template (allows you to sleect the template)

3) choose the contacts you want to send it to (produces a list of contact for that account

 

Has anyone done this or something similar?

 

How?

 

 

  • December 08, 2009
  • Like
  • 0

Hi,

 

I have setup my customer portal and a form (visualforce page) by which the user (after login / register) can update his/her profile.

 

Fields such as First Name, Last Name and Company Name is prompted and the user can update those.

 

As part of requirement I need to update the contact record associated with the "user" record as user updates his/her profile (above fields).

 

Also If the CompanyName has changed I need to create a new Account and link the contact to the new Account.

 

trigger UpdateContactFromPortalUser on User (after update) { List<Contact> contactsToUpdate = new List<Contact>(); List<string> AccountNames = new List<string>(); List<Account> Accounts = new List<Account>(); Map<String, Account> NewAccounts = new Map<String, Account>(); for(User u : Trigger.new) { String contactId = u.ContactId; if (contactId!=null && contactId!='') { AccountNames.add(u.CompanyName); } } if (AccountNames.size() > 0) Accounts = [SELECT id, name FROM account where Name in :AccountNames]; for (User u : Trigger.new) { String contactId = u.ContactId; if (contactId!=null && contactId!='' && u.PortalFlag__c == true) { Contact c = new Contact(Id=contactId); c.Email = u.Email; c.Salutation = u.Salutation__c; c.FirstName = u.FirstName; c.LastName = u.LastName; c.Title = u.Title; c.Phone = u.Phone; c.MailingStreet = u.Street; c.MailingCity = u.City; c.MailingState = u.State; c.MailingPostalCode = u.PostalCode; c.MailingCountry = u.Country; c.Department = u.Department; boolean AccountFound = false; for(Account acc : Accounts) { if (acc.Name == u.CompanyName) { c.AccountId = acc.Id; AccountFound = true; break; } } if (!AccountFound && (u.CompanyName != null && u.CompanyName != '')) { NewAccounts.put(c.Id, new Account(Name=u.CompanyName)); } contactsToUpdate.add(c); } }//loop if (contactsToUpdate.size()>0) { if (NewAccounts.size()>0) { List<Account> newaccs = NewAccounts.values(); insert newaccs; NewAccounts.putAll(newaccs); for(Contact c : contactsToUpdate) if (NewAccounts.get(c.Id) != null) { c.AccountId = NewAccounts.get(c.Id).id; } } for(Contact c : contactsToUpdate) { Utils.UpdateContact(c.Id, c.AccountId, c.Email, c.Salutation, c.FirstName, c.LastName, c.Title, c.Phone, c.MailingStreet, c.MailingCity, c.MailingState, c.MailingPostalCode, c.MailingCountry, c.Department, c.HomePhone, c.OtherStreet, c.OtherCity, c.OtherPostalCode, c.OtherState); } //update contactsToUpdate; }//contactsToUpdate end if }

 

 

 I tired two ways of doing this, one to process the records and directly update the contacts and second solution to right a method with @future prefix so that the contact records would get updated asynchroniously.

 

My problem is that at some Occassional cases I receive an error as below but NOT ALL THE TIMES!!

 

Debug Log:
System.DmlException: Update failed. First exception on row 0 with id 0038000000lmYXtAAM; first error: UNKNOWN_EXCEPTION, portal account owner must have a role: []

 

 

 


first of all, can any body explain/show the steps on how to post a screenshot as part of the message on this community. i can see people doing this but i am unable to do so.

 

anyway i try to explain in words:

 

i am trying to display an error message

 

 

 

<apex:inputText value="{!subject}" id="Subject" maxlength="80" required="true" id="Subject_Validation"/>

<apex:message for="Subject_Validation" styleClass="locationError" />

 

 it works fine but i am getting it in Awkward format  - why j_id0:j_id2:j_id11:

 

j_id0:j_id2:j_id11:Subject_Validation: Validation Error: Value is required.

 

its same for IE/Mozilla.

 

any suggestion where i am wrong.

 

 

 

In my site login is enable for example if I set IdeasHome as my site's home page the login page is prompted and forces the user to eithe login or sign up.

 

however when I make a Visualforce page the default page guest user can browse it without any authentication!

 

Is there any place where I can set this page as restricted page and force login before this page is viewed?

 

In the "public settings" I have removed the visualforce page asumming either this would force the login requirement or at least give an access denied message

None of the above the page is still being view with no problems!

 

Any iadea?

 

  • September 17, 2009
  • Like
  • 0

Hi

In our company we need to support login and self-registration features on a force.com site that we have developed. 

 

In production instance when I go to the site  "login Settings" I see the "edit" button where I can enable login functionality however in sandbox this button "Edit" is not available, we prefer to test everything in sandbox before roll it out to production.

 

How can I try login functionality before deploying it to production?

 

 Thanks

  • September 17, 2009
  • Like
  • 0