How to remove lookup selection in the client side?

Posted by ithrees on 17-Jun-2015 02:37

Hi All,

Is there anyway(any client side API) to remove the lookup selection from the client side?

Thanks,
Ithrees

Posted by Mohammed Siraj on 10-Jul-2015 01:51

You may call the following client-side JS function:

rbf_removeObject(relatedFieldIntegrationName, relatedObjectId, relatedFieldIntegrationName);

Params:

relatedFieldIntegrationName: Integration name of the related Field.

relatedObjectId: Object ID of the current selection. In case of multiple selected value, call this method multiple times, once for each selection that you wish to remove.

Note: Yes, we do need to pass the relatedFieldIntegrationName as first & third argument. This minor issue is due to some recent revision & will be revised going forward.

All Replies

Posted by Godfrey Sorita on 23-Jun-2015 09:57

Hi ithrees,

The client-side API rbf_setPicklistCode cannot set a picklist to blank as it does not have a picklist option code. However, you can use JavaScript to accomplish this. The code below sets the picklist value to blank on load of the page.

<script>
$(function(){
 setPicklistToBlank("Civil_Status");
});

function setPicklistToBlank(fieldName){
  $("#" + fieldName + " option:selected").prop("selected", false);
  $("#" + fieldName + " option:first").prop("selected", "selected");
}
</script>

Regards,

Godfrey

Posted by ithrees on 07-Jul-2015 23:04

Hi Godfrey,

Thank you for your reply, This would help me if I'm using picklist as the selector but I am using lookup with pop up selector so there I need to remove the selection.

Regards,

Ithrees

Posted by Mohammed Siraj on 10-Jul-2015 01:51

You may call the following client-side JS function:

rbf_removeObject(relatedFieldIntegrationName, relatedObjectId, relatedFieldIntegrationName);

Params:

relatedFieldIntegrationName: Integration name of the related Field.

relatedObjectId: Object ID of the current selection. In case of multiple selected value, call this method multiple times, once for each selection that you wish to remove.

Note: Yes, we do need to pass the relatedFieldIntegrationName as first & third argument. This minor issue is due to some recent revision & will be revised going forward.

Posted by Mohammed Siraj on 10-Jul-2015 01:54

An example for the above proposed solution:

rbf_removeObject("R541167" ,541037, "R541167")

Posted by ithrees on 12-Jul-2015 23:52

Thank you msiraj,

This is working fine as I wanted. Is there any way I can find these type JS functions that are not in the user guide?

Posted by Santosh Patel on 13-Jul-2015 01:30

Undocumented functions could be changed/deprecated across releases and their behavior is not guaranteed. You could use the suggested workaround for now but I highly recommend filing an idea about making this function public(documented) or a proper solution if there are other related cases that this function does not address.

This thread is closed