• Ewa Fryst
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 9
    Replies
Hi All,
Does anyone know if the Sortable Data Grid related list can be visible in mobile? Somehow i can't see it so wonder if it is possible.
Many thanks
Ewa
Hi All,
I'm trying to use the Sortable grid and filter out the tasks of a certain record type. I have a few questions.
1. How to Add a filter = OpportunityRecordType = Opportunity Action agreed. I used both Name and Id but i'm getting an error. Please find a screenshot below.
2. How to Add New action to create a new task (New Action) with record type = Opportunity Action agreed? I added the action but getting an error. Also, how to default the record type and add Subject field.
3. How to drill into the report (the subject is not a hyperlink)

I would appreciate your help.
Ewa

User-added image

User-added image

User-added image
Hello,
I have the following trigger on Case that defaults entitlements on Case record. I need to have 75% code coverage but i only managed to get 57% (found it on internet). Could anyone help me and amend the below test class to achieve the 75%?
Also, i don't really need the trigger to look at Contacts, only at Account level so that could be removed from the trigger if it is easier with writing the test class.
I would appreciate your help.
EwaUser-added image

The TRIGGER
trigger DefaultEntitlement on Case (Before Insert, Before Update) {
    Set<Id> contactIds = new Set<Id>();
    Set<Id> acctIds = new Set<Id>();
    for (Case c : Trigger.new) {
        contactIds.add(c.ContactId);
        acctIds.add(c.AccountId);
    }
    
    List <Entitlement> entls = [Select e.StartDate, e.Id, e.EndDate, 
                e.AccountId, e.AssetId
                From Entitlement e
                Where e.AccountId in :acctIds And e.EndDate >= Today 
                And e.StartDate <= Today];
        if(entls.isEmpty()==false){
            for(Case c : Trigger.new){
                if(c.EntitlementId == null && c.AccountId != null){
                    for(Entitlement e:entls){
                        if(e.AccountId==c.AccountId){
                            c.EntitlementId = e.Id;
                            if(c.AssetId==null && e.AssetId!=null)
                                c.AssetId=e.AssetId;
                            break;
    
    
                    }
                } 
            }
        } 
    } else{
        List <EntitlementContact> entlContacts = 
                [Select e.EntitlementId,e.ContactId,e.Entitlement.AssetId 
                From EntitlementContact e
                Where e.ContactId in :contactIds
                And e.Entitlement.EndDate >= Today 
                And e.Entitlement.StartDate <= Today];
    if(entlContacts.isEmpty()==false){
        for(Case c : Trigger.new){
            if(c.EntitlementId == null && c.ContactId != null){
                for(EntitlementContact ec:entlContacts){
                    if(ec.ContactId==c.ContactId){
                        c.EntitlementId = ec.EntitlementId;
                        if(c.AssetId==null && ec.Entitlement.AssetId!=null)
                            c.AssetId=ec.Entitlement.AssetId;
                        break;
                        }
                    } 
                }
            } 
        }
    }
}


THE TEST CLASS

@isTest
private class DefaultEntitlementTest {

    static testMethod void myUnitTest() {
        Account acc = new Account(Name='testacc');
        insert acc;

        Contact con = new Contact(FirstName='john', LastName='doe', Email='john@doe.com', AccountId=acc.Id);
        insert con;

        Asset ass = new Asset(AccountId=acc.Id,ContactId=con.Id, Name='testing');
        insert ass;

        Entitlement ent = new Entitlement(Name='Testing', AccountId=acc.Id, StartDate=Date.valueof(System.now().addDays(-2)), EndDate=Date.valueof(System.now().addYears(2)), AssetId=ass.Id);
        insert ent;

        Entitlement ent2 = new Entitlement(Name='test2', AccountId=acc.Id, StartDate=Date.valueof(System.now().addDays(-10)), EndDate=Date.valueof(System.now().addYears(3)));
        insert ent2;

        EntitlementContact ec = new EntitlementContact(EntitlementId=ent.Id, ContactId=con.Id);
        insert ec;

        List<Case> listC = new list<Case>();
        List<Id> newCaseIds = new List<Id>();
        for(Integer i=0;i<20;i++){
            Case c = new Case(ContactId=con.Id, AccountId=con.AccountId, Subject='Test Subject'+i, Origin='Webform_B2B');

            listC.add(c);
        }
        test.startTest();
        insert listC;

        test.stopTest();
        for (Case caseObj:listC) {
            newCaseIds.add(caseObj.Id);
        }

        List<Case> entls = [Select EntitlementId, AssetId, ContactId, AccountId From Case Where Id in :newCaseIds];

        for (Case caseObj:entls) {

            System.debug(caseObj.Id + ' here are the values ' + caseObj.EntitlementId + ' and here ent.Id ' + ent.Id);

            System.assertEquals(caseObj.EntitlementId, ent.Id);

        }
        Contact con2 = new Contact(FirstName = 'Jane',
        LastName = 'Doe',
        Email='jane@doe.com');

        insert con2;
        Entitlement ent3 = new Entitlement(Name='Testing', AccountId=acc.Id, StartDate=Date.valueof(System.now().addDays(2)), EndDate=Date.valueof(System.now().addYears(2)), AssetId=ass.Id);
        insert ent3;

        EntitlementContact ec2 = new EntitlementContact(EntitlementId=ent3.Id, ContactId=con2.Id);
        insert ec2;
        Case c1 = new Case(ContactId=con2.Id, AccountId=con.AccountId, Subject='Test Subject', Origin='Webform_B2B');
        insert c1;
        update c1;
    }
}
HI All,
I would like to prevent a user from creating a task against transactional accounts (Account Record Type = TransactionalAccount). So all the other Account records types are fine, just transactional should not have tasks. I found the trigger below. Could anyone change it for me with the Record type instead of the Type picklist? I will also need one like that for Events. I would appreciate your help.
Many thanks
Ewa

trigger TaskCanbeCreatedforSoldtoOnly on Task (before insert, before update) { set<id>accids=new set<id>(); for(task t:trigger.new){ accids.add(t.whatid); } if(!accids.isempty()){ List<Account>lstacc=[select id,Type from account where id in:accids AND Type=:'Bill To Customer']; Map<id,String>mapofaccts=new Map<id,string>(); for(account acc:lstacc){ mapofaccts.put(acc.id,acc.Type); } for(task t:trigger.new){ if(mapofaccts.containsKey(t.whatid)){ t.addError ('Please select the Sold to Customer'); } } } }
Hi All, we need a developer to do a task for us but i would like to get an estimate of how long is that going to take.

We want to automate the product bundling in Salesforce. When a user adds a product to an Opportunity, child products are automatically added as well.
Child Product and Parent product (bundle product) are linked via junction object.
I created the junction object to create a many to many relationship between Product and Parent Product so that one child product can have many parent products (can belong to many bundles) and one parent product can have many child products. 

We are looking for a developer who would either create a flow or Apex to automate the process of adding the products to the bundle. Can you please advise the level of effort?
MAny thanks
Ewa
Hi All,

I wanted to run a query on a Opp Stage value = Closed Won. I wanted to see in what automation tools that value is used. Is it possible to do that in Developer Console and if yes, could someone helo me with the query?
Many thanks in advance
Ewa
Hello Developers,
I designed a simple solution for hiring vehicles declaratively using cases for booking, assets for vehicles and contacts for customers. I need some coding capability to create a validation rule preventing a user from hiring a vehicle that is already booked. Can anyone give me an estimate effort that would require and cost? 
i would appreciate it.

Ewa
Hello,

Im trying to change a chatter group owner and when i go to Group Settings and trying to lookup another group member i cant find anyone. Please help.
I have too many fields on my page layout. i would like to hide some of them depending on the value in a picklist. So i have an object called Business review (based on case) and field Business Outcome with values Pass and Fail. Then I have Pass Reason and Fail reason fields. If business outcome value is Pass i would like to show only Pass reason field and hide Fail reason field. this is only an example but if someone could create a visualforce for me i could then change the values. I would appreciate your help.
 
Hello,
I have the following trigger on Case that defaults entitlements on Case record. I need to have 75% code coverage but i only managed to get 57% (found it on internet). Could anyone help me and amend the below test class to achieve the 75%?
Also, i don't really need the trigger to look at Contacts, only at Account level so that could be removed from the trigger if it is easier with writing the test class.
I would appreciate your help.
EwaUser-added image

The TRIGGER
trigger DefaultEntitlement on Case (Before Insert, Before Update) {
    Set<Id> contactIds = new Set<Id>();
    Set<Id> acctIds = new Set<Id>();
    for (Case c : Trigger.new) {
        contactIds.add(c.ContactId);
        acctIds.add(c.AccountId);
    }
    
    List <Entitlement> entls = [Select e.StartDate, e.Id, e.EndDate, 
                e.AccountId, e.AssetId
                From Entitlement e
                Where e.AccountId in :acctIds And e.EndDate >= Today 
                And e.StartDate <= Today];
        if(entls.isEmpty()==false){
            for(Case c : Trigger.new){
                if(c.EntitlementId == null && c.AccountId != null){
                    for(Entitlement e:entls){
                        if(e.AccountId==c.AccountId){
                            c.EntitlementId = e.Id;
                            if(c.AssetId==null && e.AssetId!=null)
                                c.AssetId=e.AssetId;
                            break;
    
    
                    }
                } 
            }
        } 
    } else{
        List <EntitlementContact> entlContacts = 
                [Select e.EntitlementId,e.ContactId,e.Entitlement.AssetId 
                From EntitlementContact e
                Where e.ContactId in :contactIds
                And e.Entitlement.EndDate >= Today 
                And e.Entitlement.StartDate <= Today];
    if(entlContacts.isEmpty()==false){
        for(Case c : Trigger.new){
            if(c.EntitlementId == null && c.ContactId != null){
                for(EntitlementContact ec:entlContacts){
                    if(ec.ContactId==c.ContactId){
                        c.EntitlementId = ec.EntitlementId;
                        if(c.AssetId==null && ec.Entitlement.AssetId!=null)
                            c.AssetId=ec.Entitlement.AssetId;
                        break;
                        }
                    } 
                }
            } 
        }
    }
}


THE TEST CLASS

@isTest
private class DefaultEntitlementTest {

    static testMethod void myUnitTest() {
        Account acc = new Account(Name='testacc');
        insert acc;

        Contact con = new Contact(FirstName='john', LastName='doe', Email='john@doe.com', AccountId=acc.Id);
        insert con;

        Asset ass = new Asset(AccountId=acc.Id,ContactId=con.Id, Name='testing');
        insert ass;

        Entitlement ent = new Entitlement(Name='Testing', AccountId=acc.Id, StartDate=Date.valueof(System.now().addDays(-2)), EndDate=Date.valueof(System.now().addYears(2)), AssetId=ass.Id);
        insert ent;

        Entitlement ent2 = new Entitlement(Name='test2', AccountId=acc.Id, StartDate=Date.valueof(System.now().addDays(-10)), EndDate=Date.valueof(System.now().addYears(3)));
        insert ent2;

        EntitlementContact ec = new EntitlementContact(EntitlementId=ent.Id, ContactId=con.Id);
        insert ec;

        List<Case> listC = new list<Case>();
        List<Id> newCaseIds = new List<Id>();
        for(Integer i=0;i<20;i++){
            Case c = new Case(ContactId=con.Id, AccountId=con.AccountId, Subject='Test Subject'+i, Origin='Webform_B2B');

            listC.add(c);
        }
        test.startTest();
        insert listC;

        test.stopTest();
        for (Case caseObj:listC) {
            newCaseIds.add(caseObj.Id);
        }

        List<Case> entls = [Select EntitlementId, AssetId, ContactId, AccountId From Case Where Id in :newCaseIds];

        for (Case caseObj:entls) {

            System.debug(caseObj.Id + ' here are the values ' + caseObj.EntitlementId + ' and here ent.Id ' + ent.Id);

            System.assertEquals(caseObj.EntitlementId, ent.Id);

        }
        Contact con2 = new Contact(FirstName = 'Jane',
        LastName = 'Doe',
        Email='jane@doe.com');

        insert con2;
        Entitlement ent3 = new Entitlement(Name='Testing', AccountId=acc.Id, StartDate=Date.valueof(System.now().addDays(2)), EndDate=Date.valueof(System.now().addYears(2)), AssetId=ass.Id);
        insert ent3;

        EntitlementContact ec2 = new EntitlementContact(EntitlementId=ent3.Id, ContactId=con2.Id);
        insert ec2;
        Case c1 = new Case(ContactId=con2.Id, AccountId=con.AccountId, Subject='Test Subject', Origin='Webform_B2B');
        insert c1;
        update c1;
    }
}
HI All,
I would like to prevent a user from creating a task against transactional accounts (Account Record Type = TransactionalAccount). So all the other Account records types are fine, just transactional should not have tasks. I found the trigger below. Could anyone change it for me with the Record type instead of the Type picklist? I will also need one like that for Events. I would appreciate your help.
Many thanks
Ewa

trigger TaskCanbeCreatedforSoldtoOnly on Task (before insert, before update) { set<id>accids=new set<id>(); for(task t:trigger.new){ accids.add(t.whatid); } if(!accids.isempty()){ List<Account>lstacc=[select id,Type from account where id in:accids AND Type=:'Bill To Customer']; Map<id,String>mapofaccts=new Map<id,string>(); for(account acc:lstacc){ mapofaccts.put(acc.id,acc.Type); } for(task t:trigger.new){ if(mapofaccts.containsKey(t.whatid)){ t.addError ('Please select the Sold to Customer'); } } } }
Hi All,

I wanted to run a query on a Opp Stage value = Closed Won. I wanted to see in what automation tools that value is used. Is it possible to do that in Developer Console and if yes, could someone helo me with the query?
Many thanks in advance
Ewa
Hello,

Im trying to change a chatter group owner and when i go to Group Settings and trying to lookup another group member i cant find anyone. Please help.
I have too many fields on my page layout. i would like to hide some of them depending on the value in a picklist. So i have an object called Business review (based on case) and field Business Outcome with values Pass and Fail. Then I have Pass Reason and Fail reason fields. If business outcome value is Pass i would like to show only Pass reason field and hide Fail reason field. this is only an example but if someone could create a visualforce for me i could then change the values. I would appreciate your help.
 

hi guys

i am prepare for the adm 201 . and i have a question .

Which of the following is the best way to make the Field Mandatory for everyone? 

A. Page Layout 
B. Validation Rule 
C. Roles & Profiles 
D. Field Level Security
and why ?? 

thanks