Update Cover Card for all users - google-mirror-api

put the case that my glassware app posts news to n users.
As soon as I parse a new news i will insert the new card into user's timeline.
Now put the case that I want to organize the news cards for category ( Sport, Politics, ... )
so now each time I post a new card I want to either post a new cover card or update the already posted one.
Given that as far as i understood the platform each cover card has a unique id per user this means the I need to store server side the id for the cover card for each user and upon update retrieving it and post the update method.
Is this correct or there is another approach I am missing?
KR

What you describe is probably the easiest method - keeping track of the cards that have been inserted for each user. It isn't, however, the only solution available. Glass provides two additional fields that you have control over, sourceItemId and bundleId, which you can use to insert cards into the Timeline and fetch them out later.
The sourceItemId field lets you set each card to an ID that represents the same card in your database. So you would create a news item, assign it an ID in your own database, set this as the sourceItemId, and insert this for each user. If you want to get the specific card that represents this item for each user later, you can use timeline.list and search by sourceItemId.
The bundleId is the ID you assign to each card which will be in a bundle to group them together, so multiple cards will have the same bundle ID. You can use timeline.list again and specify the bundleId to get all the cards in the bundle and then identify and update the one which is marked as the cover card.

Related

Implement a form in Salesforce

I am currently the Salesforce administrator of a company Enterprise account. Our accounts are made up of universities. I was asked to implement a form for trips.
The trips basic information is: Trip name, University, Region, Country, Project manager and Project manager met. I created the object trip and added the custom fields using lookup relationships with contacts and accounts. This was very easy to do so.
The first problem is as we move through the form. The next section is about the university info which has these fields: Number of students, Number of faculty, Language. They are asking me that these fields override the information that was previously stored in the account. Like if you pick X university and it had 200 students originally, then if I write 205 in the field , it will overwrite the previously set number.
My second problem is, in the next section of the form they have an objectives section.
For example, there is a text field with the label :
"Objective 1 ___________" +
if you want to add a new objective there is a "+" sign that will create a new field
"Objective 1 ___________" +
"Objective 2 ___________"
How can I achieve this? Is there a way with basic creating system? Do I need to create a Visualforce page? Thank you for your help.
This is what I understand of your 1st problem: On the trip object you have a lookup to account (university) and there are number of students etc field on the trip object and whenever a user updates it here it should be update back in the Account Object?
Instead of doing this, as you're already capturing all this data in the account object, use formula fields in the trip object to populate the data. This i think would be a better data model. But if you still wish to do it the way you intend to then you will have to write a trigger on trip object and update the account with that information. The problem with the second option would be: lets say you create a trip 1 record and update the #of students to 210, and this would be updated in the account as 210. And then you create a trip2 record for the same account and here you input the value of the #of Students field to 230, so the account(university) record with the value 230. But the problem is the value in trip 1 record will still remain 210. I hope you understand what I am trying to explain.
Coming to the 2nd Problem:
Here too the data model will be slightly different:
Create another object called Objective which has a master detail relationship with the trip object. So the Objective will be a related list in the trip object. For every trip there will be a number of objective which you can add in the related list. This is quite simple and there would be no need of any coding. But if you want to add the + sign which would display another field when the user clicked on it: In this case too the data model is the same, but you would need to create a VF page(which could either in-line VF page or a entirely an independent VF page) and then whenever a user clicks the + sign a new field is shown.

Realizing Three States By Storing Values in Single Column In DB Table

I Have List of Products Displayed in Web Page.
Each product is identified by unique product id in database.
Initially when the page loads its would be shown as Both tick and Cross under every product (Image 1)
Once the User click Tick Symbol for particular product I will display it as Interested (Image2)
When the User click Cross Symbol for particular product I will display it as Not Interested (Image3)
I should load the user last selected preference every time the page loads by storing the user name and productId for which the user is Interested.
This remains simple when there are only two states where the user might either be interested or not interested since i will store all the interested ProductaIds in DB and Use them to load user preference.That is I will apply class Interested for all the ProductIds which are in DB and NotInterested class for all those Ids which are not In database.
Now the third state is the one for which the user never touched - Image1.
I already have a DB Table Like Below
CREATE TABLE UserPreference(
UserId INT,
Interested_ProductsId VARCHAR(150)
);
I am Storing the Interested_ProductsId as CSV Product Ids (i.e) 5,75,2,15 are all product Ids
Now my question is it possible to realize the third state(Image1) in the CSV.I am storing only ProductsIds in which customer interested.How to realize the ProductsId in which customer is Not interested(Image3) and customer never clicked(Image1).
Thanks in Advance
Yes this is possible: Introduce a new column:
Type tinyint not null
CHECK (Type in (1, 2, 3))
And define type as one of your three states.
You can associate arbitrary data with your join table items. You basically promote them to "entities" that way.

Solr customizing with Websphere Commerce

I have a strange requirement in Solr.
The business model is like for each store in state (say victoria), we have different sales catalog (like Richmond, Brunswick etc) which in turn act as fulfillment centers on their own.
so my url of storeId- vic and catalogId-Richmond will retrieve me catalogues with richmond's store.
Now the requirement is I need to filter out the products based on the inventory for each of these sales catalogues.
I constructed a TI table which has the following structure
catentry_id -------- QUANTITY_RICFUL-------------QUANTITY_BrunFUL
1234-------------------0------------------------------------20
I had incorporate the changes in solr query to add these columns in the final result too.
But I do not know how to filter out the products in the front end during catalogue navigation or during search.
Any help would be much appreciated!!!
So basically you want to tie the returned catalog entries in a list with inventory? For instance, when they click on a category you do not want to display products with no inventory?
This would be a customization you can either do at the Solr Level or at the JSP level. You should probably track inventory in commerce (import it) into a field Solr can key off of and then only return items with the flag set to greater than zero. I am not sure if you need actual inventory or just a boolean. Are you using a single fulfillment center or multiple ones? Multiple gets a bit trickier and it would require them to log in most likely but then fulfillment would be addressed by the ship to address.
If the store is set up with ATP inventory then you should just get this for free, as products not in stock will simply not be displayed. Check out this page in the infocenter - http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.commerce.user.doc%2Fconcepts%2Fcosatpatpandnonatp.htm
I am not sure what you are trying to ask here but it seems you are trying to display a Quantity dropdown or display an Quantity field under each product on a search page which to me makes no sense from a UI perspective. Also keep in mind if you have integrated with a 3rd party inventory model that runs every few mins/hours etc. How often do you plan to run indexing etc?
I would rather leave such complexity to a Prodcut Detail page. If you do require to show an Quantity field on the search page I would rather prefer displaying a QuickView popup/modal that displays the color/size attributes with the quantity dropdown etc and enable a user to add an item to his/her shopping cart.

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.

Database design for a small CRM/invoicing system

I'm currently developing a small customer relationship and invoice management system for my client. And I have run into some small issues which I would like do discuss.
What is the best practice around orders, customers and products. Should my client be able to delete orders, customers and products?
Currently I have designed my database around the principle of relationships between order, customer and product like this:
Customer
ID
Name
...
Product
ID
Name
Price
...
Order
ID
CustomerID
OrderDate
...
Order Line
ID
OrderID
ProductID
Like this I can connect all the different tables. But what if my client delete a product, what happens when he later open a order he created months ago which had that item in it. It would be gone, since it has been deleted. Same goes for customer.
Should I just disable the products and customers when the delete button is clicked or what is the best practice?
If I lets say diable a product whenever my client decides to delete it, what happens then if he later tries to add a new product with the same product ID as a disabled product, should I just enable that item again?
Please share your wisdom :D
"If I lets say diable a product whenever my client decides to delete it, what happens then if he later tries to add a new product with the same product ID as a disabled product, should I just enable that item again?"
Depends entirely on your business scenario - what is unique in the way customers maintain it currently? (say manually?) How do they handle when an old product which was earlier discontinued suddenly reappears? (Do they treat it as a new product or start referring to the old product?) I guess there are no right or wrong answers to these questions, it depends on the functionality - it is always advisable to understand the existing processes (minus the software) already followed by the customers and then map them to the software functionality.
For eg. you could always add a 'A product with this code already exists - do you want to use that instead of creating a new one?' kind of a message. Also, the product ids that you use in your tables as foreign keys, and the ones that you use to show the customer, better be different - you dont want to get them mixed up.
Why would you want to be able to delete orders? I would think that such a system would lock orders so that you know you have a good history. Same goes for customers, why delete them? Perhaps a way to "archive" them, having to set some flag, that way they don't show up on customer lists or something.
As for disabling and then entering a new item with the same product ID - I'm not sure why you'd do that either, each product ID is unique for a reason, even if you discontinue a product, it should keep it's product ID so you have a record. But if you must, then you could put a constraint in the business rules, something to the effect of "If there is no product that is active with this product ID then allow it. If we have a product that is active and it has the same product ID, then throw an error." Thus, you only allow for one active product with that product ID - but honestly, I think this would be confusing, and on the back end you'll want to use a unique id that is unchanging for each product to link between tables.
Instead of "deleting" I would add a boolean column for IsActive. That way you won't loose historical data. For instance, if they are able to delete a customer then they won't be able to look at history regarding that customer and it may make looking at statistical data hard or impossible. For the order table you could have a column that represents something like "current", "canceled", "filled" to accomplish the same thing. That column should be a code to a lookup/codetable.

Resources