• chriscwharris
  • NEWBIE
  • 0 Points
  • Member since 2014


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 17
    Replies
I have an apex trigger that runs on an object that is 3 levels down in a master detail hierarchy. I'm starting to write a test class for the trigger but need to set up the test data for the test methods. Due to the complexity of requiring a parent and grandparent in place before creating the actual records being tested I figured I would use a utility class.

Having investigated various onine resources I can see lots of examples of using a utility class to create a single type of object record and have that returned as an array which can be processed in the test class but I'm not sure how you deal with multiple levels of relationship and different object types if you need to access both the parent and grandparent records from the test methods as they are both required.

As an example:

Firstly create in Utility Class
Grandparent Record (Custom Object A)
  ->    Parent Record (Custom Object B)

Then the following is created in the test Class methods but needs to access both objects created above
     ->   Detail Record test 1 (Custom Object C) (Child of Object B which is child of Object A)
     ->   Detail Record test 2 (Custom Object C) (Child of Object B which is child of Object A)
     ->   Detail Record test 3 (Custom Object C) (Child of Object B which is child of Object A)

I may be over thinking this, any advice, examples or tips appreciated!

 
Hi, I have an custom object with a trigger that performs some validation not possible using validation rules. If the trigger criteria is met I use object.addError to throw an exception and that stops the INSERT/UPDATE running. This works fine when creating a record from a button in a view or from the parent object using the actual page layout etc..
Trigger Error Example
However I have created a Flow that is accessed via the Lightning Home page using the Flow Component. That all works fine except if the trigger throws the error, instead of getting a friendly message I get an api exception error with the correct message but it's not at all friendly. I also get a flow error email every time which isn't ideal since the error isn't actually the flow crashing it's just stopping the DML.

Flow Error Issue
Anyone offer a suggestion as to how to capture the api exception and stop it throwing the flow error? I want the message to display and the DML to be stopped but gracefully!
 
I've been working with Salesforce on and off for well over a year and find it a pretty decent platform to build apps. However the licence model doesn't seem to lend itself to building bespoke apps that are not "add ons" to the core clouds Salesforce offer, it just seems too expensive.

Lets say I identified a market where I see potential for a small app that might well provide benefit. I analyse the needs, review the platform and decide that Salesforce offers all I need to build that app. The hurdle is that I want to sell this to small companies or individuals that can't afford £20 or £60 per month licence fees.

With that in mind I'm already feeling that Salesforce isn't a great app development platform in general, but is fine to build apps on to extend existing clouds or for use by large organisations with big pockets. Would you agree? Are there examples of Salesforce apps online that are completely custom and are affordable? The OEM model still requires a hefty "base" charge to cover a platform charge even before you add your own charge.
I developed a complex app with 25 objects all related to a single person. I initially developed the relationships as a Master-Detail hierarchy however it became apparent that the not being able to modify security of the related objects since they inherit from the master was a problem.

So I figured that I need to change every relationship to a Lookup instead but that means that I need to set the security on each record in code or rely on user manually setting sharing. To minimise the risk of security not being set correctly I am looking to use Apex Managed Sharing which I have tested on a single relationship.

So my question is this, In the top level record I will set 2 user lookups, these need varying levels of access to the related objects. So at the moment it looks like I will need to use the trigger to update all 24 related objects each time the user lookup fields are changed. Is updating this with a trigger the best solution? Is there a better approach? Any examples anyone can direct me to? Thanks
I have a "person" object with various name related fields (Firstname, Lastname etc..) Rather than have them duplicate entry in the actual NAME field in the object I'd like to compute it as per how the Contact object works in Salesforce. Any suggestions on how this can be done because it the moment it looks like various hacks would be needed. It's a pity the NAME field can't be a computed formula!
I have built an app with a number of objects in a hierarchy. I had figured using an auto number for the NAME field would be useful for quite a few of the objects however now I'm adding data for testing I realise that the NAME field isn't very helpful in lookups and the recent items list. So I've decided that making the TEXT may be a better idea. This leads to another issue in that duplication of data entry will be required as in certain circumstances the NAME would make sense as a computation of a number of existing text fields on the object.
I have seen posts about using workflow to set the NAME field when saved instead. Anyone else use this approach? It's a real pity that the NAME field can't have a formula!
The licence types available are a little confusing. I'm building an app that has 20+ objects out of necessity. The problem is that it would appear for me to sell it to anyone they will need the apps plus licence which at £60/user/month would make the app impossible to sell to a small company with minimal budget.

If they have 50 users who need access then that's a huge £3000/month. Is there no cheaper way to build an app and give access to it?

The app licence is still a lot at £20/month and only allows 10 objects/user, in reality how useful is that few objects.

Any thoughts?
I want to create a visualforce page that is associated with a TAB. When I click the TAB I want to open a specific record based on the currently logged in user. There will be a "User Profile" custom object that has the USER as the owner or as a lookup field.

My initial thinking was using SOQL to lookup on the profile with the !$user to get the ID of the Profile Custom record but that would require me writing the VF page with a custom controller I imagine and my VF and APEX skills are still basic.

I realise that I can pass the ID in the URL if I am opening the page from a button for example and was hoping I could do something with that but I don't want to have to open some other page and click a button to get to the record I want displayed, I just want to click the TAB and have "My" record displayed.

Any thoughts?
In order to allow some functionality to work in a group of related objects I have had to give a user edit/read access via manual sharing to the top level record, otherwise they couldn't create a child record which has values totalled in rollup fields on the parent. The consequence of that is the user can see the "create/edit" actions on the standard related lists for Tasks and Activities etc. which are included on the parent object.

I can't stop the user accessing those objects globally as they need them when used on other objects, but on this custom object I don't want them to be able to create or edit records.

Any ideas?
I have a record that has been approved and is left locked after the of the approval. I want the owner to be able to click an action that cancels the record but without them having to edit the record manually and change the status to cancelled, Can this be done? If so any tips or examples?

Thanks
I have a custom object with an approval process attached. The approval process is a single step, one user approval and at each sep the process updates the "status" field on the custom object.

The problem is tha approver is just another user in Salesforce, not the manager of the document being approved or in the hierarchy above them necessarily. I have managed to get the approval to submit by adding a new custom field to the "user" object to store the approver name. However when the approver tries to approve it fails because they clearly don't have access to change the status on the original record.

Am I right in thinking that salesforce doesn't give the approver access to the record being approved? If not, how can I automate the giving of access to the approver at the time of submission for approval and retract the access once approved?

Thanks
I have a custom app that has 3 levels of object in a master detail hierarchy. I had set the OWD so the top level was private. The records are created by members of TEAM A who should always have access to the records for all objects in the app. So I have given them modify all. There are then 2 levels of user below, TEAM MEMBERS can see their own records, i.e. those that related to them. In order to do this I have had to rely on TEAM A manually adding the TEAM MEMBER to the sharing on each record. I can't find a better way to do this at the moment as the app needs to be generic and I won't always know what the role hierarchy or groups are before installing.

Above TEAM MEMBERS are TEAM MANAGERS, they need to be able to view their own records like a TEAM MEMBER can, but also the records of THEIR TEAM. This is where I am struggling... TEAM MANAGERS need READ access to their teams records, but also Edit access to specific objects as they are using an approval cycle. However they can not have edit access to their own record, just their team.

I hope that makes sense. The key thing is that this is an app that will be installed in lots of orgs so I will not be aware of the security model of those beforehand.

In Summary:

TEAM A has CRUD to all records in app
TEAM MANGERS can read their own records, their teams records and be able to approve/update specific objects for their team
TEAM MEMBERS can read their own records only

Since I can't find a way to dynamically add users to a records I wonder how this might be done. The TEAM MANAGER is a new custom field added to the USER object so can be referenced.

Any ideas?
I have a master-detail relationship where the master record is information I want a user to see but not edit and the child is a record I want them to create. I realise that security is inherited in a master-detail however can you add additional edit rights to the child so that a user can create child records without having edit access to the parent?
I have a number of objects in a hierarchy. The top level has some information on an person, the next child level has some balances and the third level has details. Because the objects are related I currently need to navigate via the parent to the mid level object to create the detail (3rd level) record so that the relationship fields are populated and link.

I want to be able to create the detail record direct from an action on the "Home" tab, pre-populating the relationship fields based on the currently logged in salesforce ID. I basically want to create 2 relationships automatically on creation of a record.

Is this something that can be achieved via a trigger or apex? I know you can't do this via formulas.

Thanks
I have 2 custom objects that form a Parent /Child relationship. The parent is a work order and the child are logs. The logs have a time and cost based on the rate of the person doing the work so the rate is not universal.

I created a formula field on the child that works out the cost (time x rate) but I can't rollup this cost on to the parent. I can rollup the time which is simply a number field but since the rate is not universal I can't calculate the cost at the parent level.

What's the best approach?
So I have a pretty simple requirement which seems once again impossible in Salesforce. I have a parent and child, when I create the child I want to display a few values from the parent at the top of the form to assist the entry of data in the child, nothing out of the oridnary you would think. Problem is it seems output only fields or emdedded VF pages etc.. disappear when in edit mode!

Any way around this? I want to display a stock level type field on the child so users don't waste time ordering more stock than is available and I don't want them to have to wait until they try to save.

Thanks
I have a scenario where I want to have a calculation performed on and object on the front end iusing values from multiple other objects. Let me explain the scenario and I would apprecaite any pointers.

Object 1 contains some "totals"
Object 2 contains some "static numbers"

Object 3 is the working form where I want the following process if possible:

- on load, get the totals from Object 1 and display them at the top of the form
- on load get the static numbers for use in the calculation but ideally do not have them visibile
- User enters additional values
- Calculation adds new values to total from object 1 and the static numbers from object 2
- If number do not exceed threshold allow the save and then update the total on object 1 to the new total from object 3

Now I had been building this app in declarative only but I'm now wondering if this part will need to be a VF page. I assume to get the values from object 1 and 2 to use on object 3 they all need to be "related" via a master-detail or lookup. Would you do the entire page as VF or would you do parts of it in VF and embed in page layout?

I assume to update object 1 then I could either use a master-detail and a rollup field? But can I reference the rollup field cross object? If not then I guess a trigger could be used to update the object 1 with the object 3 total on save?

Appreciate any thoughts. Thanks

 
Is it possible to have a view where the filter is controlled on the fly using a drop down? As an example, say I have a list of records that have "State" as a field, I want a view of records where I can select a different State and the view filters showing only that State without creating 50 views, one for each state.
So coming from another development platform I am finding a lot of limitations in retrieving data for use in forms from other records (objects). When I found Vlookup I thought I had discovered my saviour, a way to lookup unrelated data for use in a form, but sadly it soon became clear it was only for use in validation formulas.

Is there an alternative that allows lookup of data from another object that is not "related" via a lookup or master/detail relationship? Why would I want that? Well for example, looking up a value or values from a currency object using a currency code without making the 2 objects related as the currency records are global and accessed from lots of objects etc... This is just on example so don't fixate on currency data, it could be getting a set of values using the value of a picklist to drive the lookup of that data. Thanks
I have a custom object that I require multiple users to contribute to. So I have created a queue and used a workflow rule to assign the queue when the record is created. This is fine except I need some accountability as to which members of the queue are working or have worked on the record. Ideally there would e a "list" of users who as assigned to the record, a subset of the queue members. Anyone in the queue can edit and contribute if they feel they can.

I am trying to think of the best approach so that for reporting we can see who has worked on that record. One restriction is that some members of the queue may not edit the main record but may create child records from the main record but that countds as a contributor.

One idea I had was to create 5 contributor fields and they can be manually set using a lookup to users. Of course this isn't foolproof but with the limited features in Salesforce for multiple values it may be the only solution. Any siggestions/ideas?

Thanks
I have an apex trigger that runs on an object that is 3 levels down in a master detail hierarchy. I'm starting to write a test class for the trigger but need to set up the test data for the test methods. Due to the complexity of requiring a parent and grandparent in place before creating the actual records being tested I figured I would use a utility class.

Having investigated various onine resources I can see lots of examples of using a utility class to create a single type of object record and have that returned as an array which can be processed in the test class but I'm not sure how you deal with multiple levels of relationship and different object types if you need to access both the parent and grandparent records from the test methods as they are both required.

As an example:

Firstly create in Utility Class
Grandparent Record (Custom Object A)
  ->    Parent Record (Custom Object B)

Then the following is created in the test Class methods but needs to access both objects created above
     ->   Detail Record test 1 (Custom Object C) (Child of Object B which is child of Object A)
     ->   Detail Record test 2 (Custom Object C) (Child of Object B which is child of Object A)
     ->   Detail Record test 3 (Custom Object C) (Child of Object B which is child of Object A)

I may be over thinking this, any advice, examples or tips appreciated!

 
I have a "person" object with various name related fields (Firstname, Lastname etc..) Rather than have them duplicate entry in the actual NAME field in the object I'd like to compute it as per how the Contact object works in Salesforce. Any suggestions on how this can be done because it the moment it looks like various hacks would be needed. It's a pity the NAME field can't be a computed formula!
I have a custom app that has 3 levels of object in a master detail hierarchy. I had set the OWD so the top level was private. The records are created by members of TEAM A who should always have access to the records for all objects in the app. So I have given them modify all. There are then 2 levels of user below, TEAM MEMBERS can see their own records, i.e. those that related to them. In order to do this I have had to rely on TEAM A manually adding the TEAM MEMBER to the sharing on each record. I can't find a better way to do this at the moment as the app needs to be generic and I won't always know what the role hierarchy or groups are before installing.

Above TEAM MEMBERS are TEAM MANAGERS, they need to be able to view their own records like a TEAM MEMBER can, but also the records of THEIR TEAM. This is where I am struggling... TEAM MANAGERS need READ access to their teams records, but also Edit access to specific objects as they are using an approval cycle. However they can not have edit access to their own record, just their team.

I hope that makes sense. The key thing is that this is an app that will be installed in lots of orgs so I will not be aware of the security model of those beforehand.

In Summary:

TEAM A has CRUD to all records in app
TEAM MANGERS can read their own records, their teams records and be able to approve/update specific objects for their team
TEAM MEMBERS can read their own records only

Since I can't find a way to dynamically add users to a records I wonder how this might be done. The TEAM MANAGER is a new custom field added to the USER object so can be referenced.

Any ideas?
I have a master-detail relationship where the master record is information I want a user to see but not edit and the child is a record I want them to create. I realise that security is inherited in a master-detail however can you add additional edit rights to the child so that a user can create child records without having edit access to the parent?
I have 2 custom objects that form a Parent /Child relationship. The parent is a work order and the child are logs. The logs have a time and cost based on the rate of the person doing the work so the rate is not universal.

I created a formula field on the child that works out the cost (time x rate) but I can't rollup this cost on to the parent. I can rollup the time which is simply a number field but since the rate is not universal I can't calculate the cost at the parent level.

What's the best approach?
So I have a pretty simple requirement which seems once again impossible in Salesforce. I have a parent and child, when I create the child I want to display a few values from the parent at the top of the form to assist the entry of data in the child, nothing out of the oridnary you would think. Problem is it seems output only fields or emdedded VF pages etc.. disappear when in edit mode!

Any way around this? I want to display a stock level type field on the child so users don't waste time ordering more stock than is available and I don't want them to have to wait until they try to save.

Thanks
I have a scenario where I want to have a calculation performed on and object on the front end iusing values from multiple other objects. Let me explain the scenario and I would apprecaite any pointers.

Object 1 contains some "totals"
Object 2 contains some "static numbers"

Object 3 is the working form where I want the following process if possible:

- on load, get the totals from Object 1 and display them at the top of the form
- on load get the static numbers for use in the calculation but ideally do not have them visibile
- User enters additional values
- Calculation adds new values to total from object 1 and the static numbers from object 2
- If number do not exceed threshold allow the save and then update the total on object 1 to the new total from object 3

Now I had been building this app in declarative only but I'm now wondering if this part will need to be a VF page. I assume to get the values from object 1 and 2 to use on object 3 they all need to be "related" via a master-detail or lookup. Would you do the entire page as VF or would you do parts of it in VF and embed in page layout?

I assume to update object 1 then I could either use a master-detail and a rollup field? But can I reference the rollup field cross object? If not then I guess a trigger could be used to update the object 1 with the object 3 total on save?

Appreciate any thoughts. Thanks

 
So coming from another development platform I am finding a lot of limitations in retrieving data for use in forms from other records (objects). When I found Vlookup I thought I had discovered my saviour, a way to lookup unrelated data for use in a form, but sadly it soon became clear it was only for use in validation formulas.

Is there an alternative that allows lookup of data from another object that is not "related" via a lookup or master/detail relationship? Why would I want that? Well for example, looking up a value or values from a currency object using a currency code without making the 2 objects related as the currency records are global and accessed from lots of objects etc... This is just on example so don't fixate on currency data, it could be getting a set of values using the value of a picklist to drive the lookup of that data. Thanks
I have a custom object that I require multiple users to contribute to. So I have created a queue and used a workflow rule to assign the queue when the record is created. This is fine except I need some accountability as to which members of the queue are working or have worked on the record. Ideally there would e a "list" of users who as assigned to the record, a subset of the queue members. Anyone in the queue can edit and contribute if they feel they can.

I am trying to think of the best approach so that for reporting we can see who has worked on that record. One restriction is that some members of the queue may not edit the main record but may create child records from the main record but that countds as a contributor.

One idea I had was to create 5 contributor fields and they can be manually set using a lookup to users. Of course this isn't foolproof but with the limited features in Salesforce for multiple values it may be the only solution. Any siggestions/ideas?

Thanks
Hi, does anyone have any standard word templates or the like that are geared towards capturing Salesforce app requirements, technical specifications, user documentation etc?

Thanks.
Is it possible to import the design of an object, by that I mean can you create a csv that lists row by row the fieldname, datatype etc.. and import all the fields for an object then go in after and tweek things? I don't mean "data" here, I mean the field definitions. The reason I ask is I want to develop an app on SF that I already have elsewhere and it has a lot of fields, importing them into an Object would save a lot of time.
Apologies if this has come up before but I have searched the net and these forums and couldn't find a post specific to my query. What I wanted to get feedback on is how people define security or what is recommended when building a generic custom app that will sit on app exchange?

For example, you create an app that you want to put on app exchange but of course have no idea what security model will be in place for each potential customer who takes that app. Being new to this platform I'm not clear on the best way to handle this. Do you define your own security model for the app then the customer must configure their system once they implement the app?

I hope that makes sense! If anyone can recommend a standard process or best practice that would be very much appreciated. Thanks.