Integrate Salesforce with Salesforce - salesforce

I'm trying to get updated account records from a Salesforce organization pushTopic subscription and trying to add the changes in another Salesforce organization. If the second organization already has the particular account, it should be updated else it should be create as new account. For this scenario I need to check the second organization account with first organization account records. How can we do it since Salesforce doesn't have unique key other than record id?

Create a big object which will hold the first organization record Id with the equivalent new org record Id. Through this, you will get to know the records which are already inserted.
If the record Id is not present in the big object which means that you need to create a new record and create one more big object record with a new record Id and old record Id (for further checking).
You can use custom object as well but the optimal solution could be creating a big object.

Related

Mass update of records

I have a custom object called Sales Target
I have 2 lookup fields for contact(Contact__c) and owner(OwnerId) in that object.
I have about 100 records where I need to change the Owner field to Contact field.
Any clues.
Contact records cannot be Owners of other records. Owners must be Users or Queues. You will not be able to make this change as written.
If your Contacts represent community users, you'll need to pull out those users' Ids instead.
Once you have User Ids in hand, you can make the change using any one of the many available data loaders for Salesforce, such as the Data Loader or the Data Import Wizard. You'd perform an Update operation in the data loader and would need to supply the Id of the record to update and the desired OwnerId value on each row.

Salesforce validations

I'm new in Salesforce and I have to create an app for gym owner.
I made 3 objects, Member, Membership and Booking. My member object has data about gym members like address, date of birth etc.
Membership object has fields like MEMBER(lookup relationship with Member object), START DATA, END DATE and ACTIVE (checkbox to see if membership is stil active).
If membership of that member is still active, I have to prevent customer to create another membership for that member until current expires. How can I do that?
You could pull something like that with validation rule using VLOOKUP function (but then you need to always put something fairly unique & predictable in the Name field on your membership object). I'm thinking something along the lines of "if there exists membership 'Member #1234 active' then VLOOKUP should prevent creating another one like that".
A nasty user could then delete the membership, create new one and restore it from recycle bin :P
So I have better idea for you (still without using any code). Convert membership->member lookup to master-detail relation. This would let you create rollup summary fields, read up about them. Create a rollup field that would be COUNT() of active memberships for the guy. Make validation rule that throws tantrum when you insert new membership and the count is already > 0.

SalesForce: How can I link a custom object field to a value Account record

I am trying to find a solution of how to lookup a value on the Account Object and place it in a field on a record of a Custom Object.
Details below:
Objects
Accounts/ Organizations - This contains information on different projects supported by my origination. Key fields of note: Project Name(text) and Account Balance(text). There around 100 unique records in this object These field are manual led created.
Regrant Request - This object contains records that are generated via web form that the projects fill out to receive payment for expenses related to their project. Each Regrant Request record also contains the Project Name(text) Account Balance .
Desired Result:
When a new Regrant Request record is generated from the web form, it will take the value of the Project Name, match it with a record in the Accounts/Organization object. Once the link has been made, I would like to take the value of the Account Balance in the Accounts/ Organizations Object and copy to the Regrant Request record.
The problem that I am trying to solve is that in order a project to be paid the amount of money they request in the regrant request, they have to have enough funds. It would be great if I did not have to leave the regrant request record to find this value.
I know that I have to tie each regrant request record to an account id. That is stright forward but I am stuck on how to then get a value of field for said account id and then copy to a custom object.
any ideas would be extremely helpful!
I found out how to use zapier to do a search of the account object using the value of field inputted via the online form. So cool !

how can I restrict access to records that are owned by a user

Is it possible to restrict access to records that are owned by a user by filtering out recors with a certain criteria?
For example, I have Contacts set to private and I want to hide certain contact records that have a specific field value (criteria based sharing rule). This works fine for other sales users that don't own the record, but I need to remove visibility to these records from the actual owner of the record. Is that possible or a way to accomplish that?
Thanks for any help.
You could change the owner of the Contact record to a placeholder user. Then the same mechanism the prevents other users from seeing the Contact will hide the record as well.
If required, you could also create a lookup field to track the relationship to the user who can no longer access the record.
Separately, there is a dedicated salesforce.stackexchange.com site for asking Salesforce related questions.

Create multiselect lookup in salesforce using apex

I want to create a multi-select Contact Lookup.
What i want :
When user clicks on a lookup then he should be able to select multiple contacts from that.
What i have done:
I have created an object and a field inside that object using both
"Lookup" and
"MasterDetail Relationship" and
"Junction Object"
When i try to use this Field for any input text/Field then it always provides an option to select only one value from lookup but i want to have an option to select multiple.
Even in the Junction object i have created 2 master-detail relationships still lookup allows only one value to be selected.Moreover it makes the field mandatory which i don't want.
Links that i followed:
http://success.salesforce.com/questionDetail?qId=a1X30000000Hl5dEAC
https://ap1.salesforce.com/help/doc/user_ed.jsp?loc=help&section=help&hash=topic-title&target=relationships_manytomany.htm
Can anybody suggest me how to do this.
Its same as we use Email CC/BCC under Send Email option for any Lead.
Even you use a junction object a lookup is just that, it references (looks up to) one other record: when you create a record on the junction object you still have to set each lookup individually and you're still creating only one record.
Master Detail relationships are essentially lookups on steroids, one object becomes the child of the other and will be deleted if the parent object is deleted, they're not going to provide an interface to lookup to many records at once.
If you're not a developer then your best bet is to either just create on junction object record at a time, or look into using dataloader. You could prepare your data in Excel or similar and then upload all the records into Salesforce in one go.
If you are a developer, or have developers at your disposal, then what we've done in the past is create a Visualforce page to do the job. So if, for example, you wanted to link a bunch of contacts up to an Account, we'd have a single account lookup field on the page, then some search fields relating to fields on the contact. Using a SOQL query you can then find all contacts matching the search parameters and display them in a list, where you may want to provide checkboxes to allow the user to select the contacts they want. Then it's just a case of looping through the selected contacts, setting their Account field to be the chosen account.
There are areas in Salesforce (such as the send Email functionality you mentioned) where it's clear to see that bespoke work has been done to fulfil a specific task — another instance of what you want is in the area where you can manage campaign members. This is the model I've copied in the past when implementing a Visualforce page as described.
Good luck!
For adding multiple junction objects at one time, the only solution we have found is a custom Visualforce page, as described by LaceySnr.
For a slightly different problem, where we need to assign many of object B to object A, We have trained our users to do this with a view on object B. We are assigning Billing Accounts (B) to Payment Offices (A). The view on Billing Account has check boxes on the left side. The user checks the Billing Accounts to be assigned, then double-clicks on the Payment Office field on any of the checked rows. A pop-up asks if you want to update only the single row or all checked rows. By selecting 'all checked rows', the update is done to all of them.
The view is created by the user, who enters the selection criteria (name, address, state, etc.). All user-created views are visible only to them.

Resources