• girbot56
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 19
    Replies
Hi all,

I am trying to mask certain details in the body of an email message using regex and the string method replaceall. I've no issue with the regex, I can see it matching and can add a value to the body with a match. However I have not been able to replace the matched substring, this is what I am trying at the moment:

String mask = '*';
String embody = 'Test text body 1111 test';

Pattern p = Pattern.Compile('(\\d{4})'); //simplified
p.matcher(em.TextBody).replaceAll(Mask);
As I mentioned I am confident that the regex is matching by using debug comments and I have updated the field on a match but I cannot get replaceall to work :(

What I am missing?


Hi,
I would like to be able to build a VF table that shows the number of records that appear in each ListView. I can happily hard code the queries and have the page refresh on a schedule but I would the VF page to automatically display the list views the current user can access and the record count.

I can display a table with the ListView names but not sure how to return the number of records for each one...any help appreciated :)
Hi, Is it possible to write a query for the below? Show certain fields from the Opportunity Line Item, grouping by the Account Name, where that Product appears more than once under the Account. Just to clarify I have two custom formula fields on the Opportunity Line Item that pulls the Account Id/Name and Product Id, these are the two that I have been trying to use to achieve the above I beleive there is a limitation on using formula fields with GROUP BY but I am happy to amend to a text field and workflow rule if necessary, but I would appreciate some guidance on if the above query is possible first? Thanks in advance :)

Hi all,

 

I have been looking into using a trigger to prevent Case deletion, the reason being that delete is required in order for the users to be able to mass update Cases from list views but we don't want any Cases deleted.

 

I'm not a developer by trade but my current trigger is below. It works as intended but I wanted to check if this is the best approach/ask for opmitisation advice, e.g. the best way to bulkify.

 

Thanks in advance.

 

trigger trg_CasePreventDelete on Case (before delete) {
//Trigger to prevent deletion of Cases other by profiles named below  
   
	String profileId=userinfo.getProfileId();
	String profileName=[Select Id,Name from Profile where Id=:profileId].Name;
	system.debug('ProfileName'+profileName);
    
	if(profileName != 'System Administrator')
    
	for (Case CasetoPrevent: trigger.old)
     
		{
        		CasetoPrevent.addError('You do not have permission to delete Cases');
		}
}

 

Hi all!

 

Relatively new to Apex but I have the controller extension below:

 

public class ControllerExt
{
    ApexPages.StandardController stdCtrl;
    public ControllerExt(ApexPages.StandardController std)
    {
       stdCtrl=std;
    }

    public PageReference save()
    {
        stdCtrl.save();
        return null;        
    }
}

 And I have been, unsuccesfully, trying to write the test code for it. My current attempt is below (saves and runs with no errors), but the code coverage is 0...any suggestions?

 

@isTest
public class ControllerExtTest {
    static testMethod void myPage_Test() {
        PageReference pageRef = Page.TypeA;
        Test.setCurrentPage(pageRef);
        
                Account acc1 = new Account (Name = 'Account 1', Type = 'Type A');
                insert acc1;        
                Opportunity opp1 = new Opportunity(Name = 'Opportunity1', AccountID = acc1.id, Probability = 20.00, CloseDate = Date.newInstance(System.now().year(),10,10), StageName = 'Prospect');
                insert opp1;

        ApexPages.StandardController sc = new ApexPages.standardController(opp1);
        
        String nextPage = sc.save().getUrl();
       
        String str1 = string.valueof (opp1.Id).substring (0, 15);
        System.assertEquals('/'+str1, nextPage);
    }
}

 

Hi all,

 

I have been looking into using a trigger to prevent Case deletion, the reason being that delete is required in order for the users to be able to mass update Cases from list views but we don't want any Cases deleted.

 

I'm not a developer by trade but my current trigger is below. It works as intended but I wanted to check if this is the best approach/ask for opmitisation advice, e.g. the best way to bulkify.

 

Thanks in advance.

 

trigger trg_CasePreventDelete on Case (before delete) {
//Trigger to prevent deletion of Cases other by profiles named below  
   
	String profileId=userinfo.getProfileId();
	String profileName=[Select Id,Name from Profile where Id=:profileId].Name;
	system.debug('ProfileName'+profileName);
    
	if(profileName != 'System Administrator')
    
	for (Case CasetoPrevent: trigger.old)
     
		{
        		CasetoPrevent.addError('You do not have permission to delete Cases');
		}
}

 

Hi all,

I am trying to mask certain details in the body of an email message using regex and the string method replaceall. I've no issue with the regex, I can see it matching and can add a value to the body with a match. However I have not been able to replace the matched substring, this is what I am trying at the moment:

String mask = '*';
String embody = 'Test text body 1111 test';

Pattern p = Pattern.Compile('(\\d{4})'); //simplified
p.matcher(em.TextBody).replaceAll(Mask);
As I mentioned I am confident that the regex is matching by using debug comments and I have updated the field on a match but I cannot get replaceall to work :(

What I am missing?


Hello Experts,

Can anyone shed some light on below requirement? I am banging my head from one day to achieve this requirement.

User Story:
We have setup Salesforce outlook integration to our client. Now client requesting us to Flag an object (Contact, Task and Event) created in Salesforce from the Salesforce for Outlook integration.

Eg: For instance, when a task synced from outlook to Salesforce, that task need to have a flag which is checked true.

Any thoughts and solutions will be greatly appreciated!

Thanks,
Manisha
Hi All,

I dont know if this is possible, i have a list of objects (line items) that im displaying on a vf page allowing the user to add new objects and what i need to do is ensure the a quantity on the newly added object matches a quantity on the parent object. Does anyone know if i can do this using a validation rule rather that a trigger?

So i have:

Parent Object Quantity 54
    line item 1 Quantity 0
    line item 2 Quantity 45
    line item 3 Quantity 54

so if line item 3 is the new obect and i need to test if this quanitity is the same as the parent quantity how would i do that with a validation rule .. if i can.

Thanks
Hi Team,

One of my Requirement is that i need a sandbox with unlimited space for Knowledge Articles. Can i get this in Partial Data Sandbox  or  in Full copy Sandbox ( But in Full Copy Sandbox i do  not need Production Data only Configuration Data should copy). 
Hello,

I have several basic questions pertaining to Workflows and approvals after reading Chapter 9 on Fundamentals books.

1. I have a new user created under my existing DE org. When I open up a second browser instance and wanted to switch back and forth, it "automatically" changes to the other user. I don't know why / how it got changed. From a given "user instance" on the screen, how do I change to the "other user instance" without having to log out and log in. If I have to multi-user approval/WF scenarios, how do I do with a single DE org?

2.  The first time I setup the approval process, I got an option to add the "approval related list" on the object on which I'm setting up the approval process. However, when I tried to do that subsequently, I never see that option, why?

3. Under time dependent WF actions, it states in the book that they are actions that occur before a certain amount of time has elapsed  - example given was seven days before the value of the hire by field. I didn't quite understand this example. In my mind, actions happen only a rule critieria has been "met", so an action can always "happen" after the fact. Can someone help explain?

4. In the book, it states when you accept positions from "unclaimed positions queue", it automatically removes those entries from under the "Time Based Workflow Menu" which you can access from the setup page. In my case, the records are still showing up even though I accept them. Not sure what am I missing here.

5. How to debug a WF rule line by line using the developer console? Can you do that for WF rules completely built using the platform? Pl share an example on how to do that.

6. On the approval process, when you choose "Next automated approved determined by"  - when you choose "Manager field", I have a few questions.

Let's say, I'm a recruiter, R1 and my Manager is RM1

The hiring mgr for the position is HM1 and his supervisor is HM2

As a recruiter, when I submit a position for approval, if this option is chosen, then would the position record go RM1 for approval, since he is the manager for R1 vs. the record going to HM1 for first level of approval and then to HM2 for the final approval (in a 2 step approval process). In this case, should I chose "create hierarchial relationship of R1 -> HM1 -> HM2), is this correct?

Thanks for your help !
  • February 24, 2014
  • Like
  • 0
We recently started experiencing an error with converting leads and editing accounts, which I suspect was caused by inactivating a user who is no longer with our company (since this is the only change we have made in the period before this problem started last week). When a user (any user, even an admin) attempts to convert a lead or make an edit they receive:

Error: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, GenerateNewOrder: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to SObject Trigger.GenerateNewOrder: line 6, column 1: [] (System Code)


After contacting Salesforce Support they suggested that there was an issue with a trigger that was causing the error we were receiving since the trigger was referencing a user who no longer existed. However, I miffed as to WHICH trigger it may be since we have dozens set up. Salesforce support has suggested the following which is essentially Greek to me and I am not quite sure where to start:

1. Check the Debug logs and get to the line number of the class where it's throwing that error message.

You will get a query on that line number.

Run that query in the developer console and you should get zero records.

This error occurs when query doesn't return any rows. For e.g.

Account a = [select id, name from Account where name = 'test'];

To avoid this exception, create a list of account

List<Account> lstAccount = [select id, name from Account where name = 'test'];
if (lstAccount.size() > 0)
{
Account a = lstAccount.get(0);
}

2. Alternatively, you now know the exception, so you can use try/catch as well.


Any suggestions? I'm really unsure where to start by even narrowing down which trigger it should be, just short of going through each and every one...
Is there a way to retrieve the List View options for a given object through the controller.

We have a page that shows the List View Options, but we want to display a count of records per list, so need to have a controller return the Options plus the counts.


So I was wondering how I can attach a file to an opportunity. Basically what we do is sell a product online that requires an agreement. When they buy the product, we generate a pdf of the agreement and mail it to them. What I would like to do is upload the pdf agreement and attach it to the corresponding opportunity . I am pretty sure this can be accomplished, but I don't see much documentation on it. I am using conga composer salesforce appexchange its send mail to users with attchments and showing in Activity History in opportunity related list with file name but its not showing in attchments . Any one have any ideas?
  • February 17, 2014
  • Like
  • 0
Occasionally users do things they should not when using flows, such as entering multiple email addresses into an email field.

This triggers an unhandled proces fault, and I get the notification.

The notification, however, does not include the User ID of the user that triggered the issue, so I cannot reach out to the user to let them know what the issue was.  The notification only inserts my Organization ID.  Notification copied below.

Encountered unhandled fault when running process Quick_Create_Contact/30140000000TNMG exception by user/organization: 00D400000007YpG/{4}

Is there any way to figure out which user triggered the fault?  Else, please update the notification template!!!
I created a dynamic choice using the NPSP's Affiliation object. It works fine within Salesforce but when I make it public via Sites the dynamic choices are not visible.  I've triple checked that all the permissions for the objects, its fields and even related objects are good for the Sites user profile. I've seen some mumbling with there being perhaps a bug with dynamic choices. Has anyone seen similar behavior? Does anyone have a suggestion?
Hi,
I would like to be able to build a VF table that shows the number of records that appear in each ListView. I can happily hard code the queries and have the page refresh on a schedule but I would the VF page to automatically display the list views the current user can access and the record count.

I can display a table with the ListView names but not sure how to return the number of records for each one...any help appreciated :)
We have a visual workflow enabled for a site. 

The visual worflow incldues the SendEmail apex plugin to send a confirmation email to a customer. However, it uses my email address whereas we want to use a generic from address (e.g. support@...)

1. How can you set the from address? 
2. Why does it pick me by default? Is it because I am the Site Contact? Or the Flow designer? 
I've created a flow using Visual Workflow, whose purpose is for web users to sign up for one of a series of upcoming events (tracked as Campaigns in our org).  On the main screen for the flow, I've created a picklist populated by a Dynamic Choice, which contains the campaign options.

All works well when logged into Salesforce.  I can run the flow, and the campaign options I want show up in the picklist.  I can embed it in a Visualforce page, and view that page within Salesforce, and everything is fine. The problem is when I create a force.com site and put the Visualforce page there.  Then everything shows up except the dynamic choices.

I am aware of Public Access Settings on sites, and yes, I did remember to make Campaigns available (read-only) to the users of the site I created.  Incidentally, I did further testing and experienced the same issue with a custom object as I did with campaigns (the dynamic custom-object choices I defined displayed everywhere except on the force.com site, despite my public access settings adjustments).

Thanks so much in advance for any help you can provide!
I've built an elaborate flow with some sub flows that seems to work great.  There are however some issuess that I'm having...

For this discussion, I'm primarily focused on combining two text fields into a single field and adding a space between the two values... The result will be used during a record create...

on a screen I have three fields [First Name] [Middle Name] [Last Name].  In most cases I want this value stored as three seperate fields which again works just fine. However, I have a scenario where I want to combine all 3 fields into a single variable called varFullName. When I use an assigment to set varFullName equals FirstName, varFullName add MiddleName, varFullName add LastName. I get the following result for David A. Greer (DavidA.Greer) notice their are no spaces between the three items...

So here is what I've tried (none have worked)

- created a text template with a space and added this twice to above assigment (FN SP MN SP LN) begin FN with "equal" others have "add" Still get (DavidA.Greer)

- created a text template with &nbsp; between KERNING="0">&nbsp;</Font>.... (same result at previous) <note, however I've been using this to create a space successfully in help/display text to for paragraph spacing, but dosn't work for creating SF records. meaning the result is
David<SPAN..............>&nbsp;</FONT>A.<DIV...........etc. (i cut down the 200+characters to protect the inocent) Clearly this didn't work.

- I created a contant with a space, which after saved appears to disaper, rendering (DavidA.Greer)

- I tried to add a space in the "from field" in the assigment, but during save this resulted in an error

- I tried adding " " to the from field, no error, but results in (David" "A." "Greer) Clearly incorrect as well...

So Can anyone help me under stand how to force a space between two(multiple) values. that are merged together into a variable...

PS. I have 2 address sections where I'm trying to combine Address Line 1 and Address line 2 into a single varAddressStreet to prevent users from entering the CR in the multiline address fields...

I also have some other cases to combine fields like this...  I hope their is a simple solution to this.
Hi, Is it possible to write a query for the below? Show certain fields from the Opportunity Line Item, grouping by the Account Name, where that Product appears more than once under the Account. Just to clarify I have two custom formula fields on the Opportunity Line Item that pulls the Account Id/Name and Product Id, these are the two that I have been trying to use to achieve the above I beleive there is a limitation on using formula fields with GROUP BY but I am happy to amend to a text field and workflow rule if necessary, but I would appreciate some guidance on if the above query is possible first? Thanks in advance :)

Hi all,

 

I have been looking into using a trigger to prevent Case deletion, the reason being that delete is required in order for the users to be able to mass update Cases from list views but we don't want any Cases deleted.

 

I'm not a developer by trade but my current trigger is below. It works as intended but I wanted to check if this is the best approach/ask for opmitisation advice, e.g. the best way to bulkify.

 

Thanks in advance.

 

trigger trg_CasePreventDelete on Case (before delete) {
//Trigger to prevent deletion of Cases other by profiles named below  
   
	String profileId=userinfo.getProfileId();
	String profileName=[Select Id,Name from Profile where Id=:profileId].Name;
	system.debug('ProfileName'+profileName);
    
	if(profileName != 'System Administrator')
    
	for (Case CasetoPrevent: trigger.old)
     
		{
        		CasetoPrevent.addError('You do not have permission to delete Cases');
		}
}

 

Hi all!

 

Relatively new to Apex but I have the controller extension below:

 

public class ControllerExt
{
    ApexPages.StandardController stdCtrl;
    public ControllerExt(ApexPages.StandardController std)
    {
       stdCtrl=std;
    }

    public PageReference save()
    {
        stdCtrl.save();
        return null;        
    }
}

 And I have been, unsuccesfully, trying to write the test code for it. My current attempt is below (saves and runs with no errors), but the code coverage is 0...any suggestions?

 

@isTest
public class ControllerExtTest {
    static testMethod void myPage_Test() {
        PageReference pageRef = Page.TypeA;
        Test.setCurrentPage(pageRef);
        
                Account acc1 = new Account (Name = 'Account 1', Type = 'Type A');
                insert acc1;        
                Opportunity opp1 = new Opportunity(Name = 'Opportunity1', AccountID = acc1.id, Probability = 20.00, CloseDate = Date.newInstance(System.now().year(),10,10), StageName = 'Prospect');
                insert opp1;

        ApexPages.StandardController sc = new ApexPages.standardController(opp1);
        
        String nextPage = sc.save().getUrl();
       
        String str1 = string.valueof (opp1.Id).substring (0, 15);
        System.assertEquals('/'+str1, nextPage);
    }
}